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.

SETA instructionarithmetic value −2 is used. Therefore, &D is assigned the arithmetic value +8. When&D is used in statement 6, the arithmetic value +8 is converted to the character 8.The following example shows how the value assigned to a SETA symbol may bechanged in a macro definition.MACRO&NAME MOVE &TO,&FROMLCLA&A&A SETA 5 Statement 1&NAME ST 2,SAVEAREAL 2,&FROM&A Statement 2&A SETA 8 Statement 3ST 2,&TO&A Statement 4L2,SAVEAREAMEND-------------------------------------------------------------------HERE MOVE FIELDA,FIELDB-------------------------------------------------------------------+HERE ST 2,SAVEAREA+ L 2,FIELDB5+ ST 2,FIELDA8+ L 2,SAVEAREAStatement 1 assigns the arithmetic value +5 to SETA symbol &A. In statement 2, &Ais converted to the character 5. Statement 3 assigns the arithmetic value +8 to &A. Instatement 4, therefore, &A is converted to the character 8, instead of 5.A SETA symbol may be used with a symbolic parameter to refer to an operand inan operand sublist. If a SETA symbol is used for this purpose, it must have beenassigned a positive value.Any expression that may be used in the operand field of a SETA instruction maybe used to refer to an operand in an operand sublist. Sublists are described in“Sublists in operands” on page 302.The following macro definition adds the last operand in an operand sublist to thefirst operand in an operand sublist and stores the result at the first operand. Asample macro instruction and generated statements follow the macro definition.MACROADDX &NUMBER,&REG Statement 1LCLA&LAST&LAST SETA N’&NUMBER Statement 2L&REG,&NUMBER(1)A &REG,&NUMBER(&LAST) Statement 3ST&REG,&NUMBER(1)MEND-------------------------------------------------------------------ADDX (A,B,C,D,E),3 Statement 4-------------------------------------------------------------------+ L 3,A+ A 3,E+ ST 3,A&NUMBER is the first symbolic parameter in the operand field of the prototypestatement (statement 1). The corresponding characters (A,B,C,D,E) of the macroinstruction (statement 4) are a sublist. Statement 2 assigns to &LAST the arithmeticvalue +5, which is equal to the number of operands in the sublist. Therefore, instatement 3, &NUMBER(&LAST) is replaced by the fifth operand of the sublist.358 <strong>HLASM</strong>: <strong>V1R6</strong> <strong>Language</strong> <strong>Ref</strong>

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

Saved successfully!

Ooh no, something went wrong!