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 instruction&I SETC ’C’’’.’&X’(1,1).’’’’&VAL SETA &TRANS(&I)The first statement sets &I to C’A’. The second statement extracts the 193rd elementof &TRANS (C’A’ = X’C1’ = 193).The following code converts a hexadecimal value in &H into a decimal value in&VAL:&X SETC ’X’’&H’’’&VAL SETA &XThe following code converts the double-byte character Da into a decimal value in&VAL. &VAL can then be used to find an alternative code in a subscripted SETCvariable:&DA SETC ’G’’’’’&VAL SETA &DAAlthough you can use a predefined absolute symbol as an operand in a SETAexpression, you cannot substitute a SETC variable whose value is the same as thesymbol. For example:ABS EQU 5&ABS SETA ABS &ABS has value 5&CABS SETC ’ABS’ &CABS has value ’ABS’&ABS SETA &CABS invalid usageDBCS assembler option: The G-type self-defining term is valid only if the DBCSassembler option is specified.Using SETA symbolsThe arithmetic value assigned to a SETA symbol is substituted for the SETAsymbol when it is used in an arithmetic expression. If the SETA symbol is not usedin an arithmetic expression, the arithmetic value is converted to a character stringcontaining its absolute value, with leading zeros removed. If the value is 0, it isconverted to a single 0.Example:MACRO&NAME MOVE &TO,&FROMLCLA&A,&B,&C,&D&A SETA 10 Statement 1&B SETA 12 Statement 2&C SETA &A−&B Statement 3&D SETA &A+&C Statement 4&NAME ST 2,SAVEAREAL 2,&FROM&C Statement 5ST 2,&TO&D Statement 6L2,SAVEAREAMEND-------------------------------------------------------------------HERE MOVE FIELDA,FIELDB-------------------------------------------------------------------+HERE ST 2,SAVEAREA+ L 2,FIELDB2+ ST 2,FIELDA8+ L 2,SAVEAREAStatements 1 and 2 assign the arithmetic values +10 and +12, respectively, to theSETA symbols &A and &B. Therefore, statement 3 assigns the SETA symbol &C thearithmetic value −2. When &C is used in statement 5, the arithmetic value −2 isconverted to the character 2. When &C is used in statement 4, however, theChapter 9. How to write conditional assembly instructions 357

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

Saved successfully!

Ooh no, something went wrong!