11.07.2015 Views

HLASM: V1R6 Language Ref

HLASM: V1R6 Language Ref

HLASM: V1R6 Language Ref

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Macro definitionA macro definition provides the assembler with:v The name of the macrov The parameters used in the macrov The sequence of statements the assembler generates when the macro instructionappears in the source program.Every macro definition consists of a macro definition header statement (MACRO),a macro instruction prototype statement, one or more assembler languagestatements, and a macro definition trailer statement (MEND), as shown inFigure 25.┌──────────────────────────────► MACRO│┌────────────────────────────────────────────┐│ Prototype │ &LABEL MACID &PARAM1,&PARAM2 ││ │ └─┬─┘ └──────┬──────┘ ││ │ ▌2▐ ▌3▐ ││ ┌ ├────────────────────────────────────────────┤│ │ │ │▌1▐ │ │ ││ │ │ ││ ▌5▐─┤ │ Body of macro ││ │ │ ││ │ │ ││ │ │ ││ └ └────────────────────────────────────────────┘└──────────────────────────────► MEND▌4▐┌───────┴───────┐Macro instruction MACID OPERAND1,OPERAND2Model236 <strong>HLASM</strong>: <strong>V1R6</strong> <strong>Language</strong> <strong>Ref</strong>Figure 25. Parts of a macro definitionv The macro definition header and trailer statements (MACRO and MEND)indicate to the assembler the beginning and end of a macro definition (see ▌1▐ inFigure 25).v The macro instruction prototype statement names the macro (see ▌2▐ inFigure 25), and declares its parameters (see ▌3▐ in Figure 25). In the operandfield of the macro instruction, you can assign values (see ▌4▐ in Figure 25) to theparameters declared for the called macro definition.v The body of a macro definition (see ▌5▐ in Figure 25) contains the statementsthat are generated when you call the macro. These statements are called modelstatements; they are usually interspersed with conditional assembly statements orother processing statements.statementsYou can write machine instruction statements and assembler instruction statementsas model statements. During macro generation, the assembler copies them exactlyas they are written. You can also use variable symbols as points of substitution in amodel statement. The assembler enters values in place of these points ofsubstitution each time the macro is called.The three types of variable symbols in the assembler language are:v Symbolic parameters, declared in the prototype statementv System variable symbolsv SET symbols, which are part of the conditional assembly language

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!