HLASM Language Reference
HLASM Language Reference HLASM Language Reference
SETA Instruction In evaluating the arithmetic expression in the fifth statement, the first term, &C(1), is assigned the binary value 11 (decimal 5). To that is added the value represented by the EBCDIC character A (hexadecimal C1, which corresponds to decimal 193). Then the value represented by the third term &C(3) is subtracted, and the value of &A becomes 5+193−23=175. This feature lets you associate numeric values with EBCDIC or hexadecimal characters to be used in such applications as indexing, code conversion, translation, and sorting. Assume that &X is a character string with the value ABC. &I SETC 'C'''.'&X'(1,1).'''' &VAL SETA &TRANS(&I) The first statement sets &I to C'A'. The second statement extracts the 193rd element of &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 &X The 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 SETC variable: &DA SETC 'G''''' &VAL SETA &DA Although you can use a predefined absolute symbol as an operand in a SETA expression, you cannot substitute a SETC variable whose value is the same as the symbol. For example: ABS EQU 5 &ABS SETA ABS &ABS has value 5 &CABS SETC 'ABS' &CABS has value 'ABS' &ABS SETA &CABS invalid usage DBCS Assembler Option: The G-type self-defining term is valid only if the DBCS assembler option is specified. Using SETA symbols The arithmetic value assigned to a SETA symbol is substituted for the SETA symbol when it is used in an arithmetic expression. If the SETA symbol is not used in an arithmetic expression, the arithmetic value is converted to a character string containing its absolute value, with leading zeros removed. If the value is 0, it is converted to a single 0. Example: 360 HLASM V1R5 Language Reference
SETA Instruction MACRO &NAME MOVE &TO,&FROM LCLA &A,&B,&C,&D &A SETA 1 Statement 1 &B SETA 12 Statement 2 &C SETA &A–&B Statement 3 &D SETA &A+&C Statement 4 &NAME ST 2,SAVEAREA L 2,&FROM&C Statement 5 ST 2,&TO&D Statement 6 L 2,SAVEAREA MEND ------------------------------------------------------------------- HERE MOVE FIELDA,FIELDB ------------------------------------------------------------------- +HERE ST 2,SAVEAREA + L 2,FIELDB2 + ST 2,FIELDA8 + L 2,SAVEAREA Statements 1 and 2 assign the arithmetic values +1 and +12, respectively, to the SETA symbols &A and &B. Therefore, statement 3 assigns the SETA symbol &C the arithmetic value −2. When &C is used in statement 5, the arithmetic value −2 is converted to the character 2. When &C is used in statement 4, however, the arithmetic 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 be changed in a macro definition. MACRO &NAME MOVE &TO,&FROM LCLA &A &A SETA 5 Statement 1 &NAME ST 2,SAVEAREA L 2,&FROM&A Statement 2 &A SETA 8 Statement 3 ST 2,&TO&A Statement 4 L 2,SAVEAREA MEND ------------------------------------------------------------------- HERE MOVE FIELDA,FIELDB ------------------------------------------------------------------- +HERE ST 2,SAVEAREA + L 2,FIELDB5 + ST 2,FIELDA8 + L 2,SAVEAREA Statement 1 assigns the arithmetic value +5 to SETA symbol &A. In statement 2, &A is converted to the character 5. Statement 3 assigns the arithmetic value +8 to &A. In statement 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 in an operand sublist. If a SETA symbol is used for this purpose, it must have been assigned a positive value. Chapter 9. How to Write Conditional Assembly Instructions 361
- Page 330 and 331: Values in Operands Parentheses In m
- Page 332 and 333: Inner and Outer Macro Instructions
- Page 334 and 335: Levels of Macro Call Nesting When t
- Page 336 and 337: Levels of Macro Call Nesting System
- Page 338 and 339: How to Write Conditional Assembly I
- Page 340 and 341: SET Symbols SET Symbol Specificatio
- Page 342 and 343: SET Symbols Figure 86 (Page 3 of 3)
- Page 344 and 345: Data Attributes this example indica
- Page 346 and 347: Data Attributes variable_symbol is
- Page 348 and 349: Data Attributes The value of an att
- Page 350 and 351: Data Attributes The following attri
- Page 352 and 353: Data Attributes Assembler gives a t
- Page 354 and 355: Data Attributes The scale attribute
- Page 356 and 357: Data Attributes Number Attribute (N
- Page 358 and 359: Data Attributes The operation code
- Page 360 and 361: Lookahead MACRO &NAME MOVE &TO,&FRO
- Page 362 and 363: Open Code Sequence Symbols The cond
- Page 364 and 365: GBLA, GBLB, and GBLC Instructions G
- Page 366 and 367: LCLA, LCLB, and LCLC Instructions s
- Page 368 and 369: SETA Instruction expression is an a
- Page 370 and 371: SETA Instruction | The logical-exp
- Page 372 and 373: SETA Instruction | Figure 99 (Page
- Page 374 and 375: SETA Instruction | The result of C2
- Page 376 and 377: SETA Instruction NOT Format: Logica
- Page 378 and 379: SETA Instruction | X2A Name Operati
- Page 382 and 383: SETB Instruction Any expression tha
- Page 384 and 385: SETB Instruction ┌─────
- Page 386 and 387: SETB Instruction | ISDEC | Format:
- Page 388 and 389: SETB Instruction The two comparands
- Page 390 and 391: SETC Instruction Notes: 1. The asse
- Page 392 and 393: Figure 103. Substring Notation in C
- Page 394 and 395: Loc Object Code Addr1 Addr2 Stmt So
- Page 396 and 397: | B2C('111111') has value '3' | B2C
- Page 398 and 399: | Output: D2B('decstring') converts
- Page 400 and 401: SIGNED Format: Logical-expression,
- Page 402 and 403: | X2D('') has value '+' | X2D('91')
- Page 404 and 405: Concatenation of strings containing
- Page 406 and 407: MACRO &NAME MOVE &TO,&FROM LCLC &PR
- Page 408 and 409: SETAF Instruction Alternative State
- Page 410 and 411: Branching Branching You can control
- Page 412 and 413: AGO Instruction The extended AIF in
- Page 414 and 415: ACTR Instruction AGOB—Synonym of
- Page 416 and 417: ANOP Instruction statement processe
- Page 418 and 419: MHELP Instruction MHELP B'10000000'
- Page 420 and 421: 400 HLASM V1R5 Language Reference
- Page 422 and 423: Assembler Instructions and Statemen
- Page 424 and 425: Assembler Instructions and Statemen
- Page 426 and 427: Assembler Instructions and Statemen
- Page 428 and 429: Summary of Constants Figure 113. Su
SETA Instruction<br />
MACRO<br />
&NAME MOVE &TO,&FROM<br />
LCLA<br />
&A,&B,&C,&D<br />
&A SETA 1 Statement 1<br />
&B SETA 12 Statement 2<br />
&C SETA &A–&B Statement 3<br />
&D SETA &A+&C Statement 4<br />
&NAME ST 2,SAVEAREA<br />
L 2,&FROM&C Statement 5<br />
ST 2,&TO&D Statement 6<br />
L<br />
2,SAVEAREA<br />
MEND<br />
-------------------------------------------------------------------<br />
HERE MOVE FIELDA,FIELDB<br />
-------------------------------------------------------------------<br />
+HERE ST<br />
2,SAVEAREA<br />
+ L 2,FIELDB2<br />
+ ST 2,FIELDA8<br />
+ L 2,SAVEAREA<br />
Statements 1 and 2 assign the arithmetic values +1 and +12, respectively, to the<br />
SETA symbols &A and &B. Therefore, statement 3 assigns the SETA symbol &C<br />
the arithmetic value −2. When &C is used in statement 5, the arithmetic value −2 is<br />
converted to the character 2. When &C is used in statement 4, however, the<br />
arithmetic value −2 is used. Therefore, &D is assigned the arithmetic value +8.<br />
When &D is used in statement 6, the arithmetic value +8 is converted to the<br />
character 8.<br />
The following example shows how the value assigned to a SETA symbol may be<br />
changed in a macro definition.<br />
MACRO<br />
&NAME MOVE &TO,&FROM<br />
LCLA<br />
&A<br />
&A SETA 5 Statement 1<br />
&NAME ST 2,SAVEAREA<br />
L 2,&FROM&A Statement 2<br />
&A SETA 8 Statement 3<br />
ST 2,&TO&A Statement 4<br />
L<br />
2,SAVEAREA<br />
MEND<br />
-------------------------------------------------------------------<br />
HERE MOVE FIELDA,FIELDB<br />
-------------------------------------------------------------------<br />
+HERE ST<br />
2,SAVEAREA<br />
+ L 2,FIELDB5<br />
+ ST 2,FIELDA8<br />
+ L 2,SAVEAREA<br />
Statement 1 assigns the arithmetic value +5 to SETA symbol &A. In statement 2, &A<br />
is converted to the character 5. Statement 3 assigns the arithmetic value +8 to &A.<br />
In statement 4, therefore, &A is converted to the character 8, instead of 5.<br />
A SETA symbol may be used with a symbolic parameter to refer to an operand in<br />
an operand sublist. If a SETA symbol is used for this purpose, it must have been<br />
assigned a positive value.<br />
Chapter 9. How to Write Conditional Assembly Instructions 361