HLASM Language Reference
HLASM Language Reference HLASM Language Reference
SETA Instruction | X2A Name Operation Operand &OP1 SETA -344 &OP2 SETA 4 &VAR SETA (&OP1 SRL &OP2) | Format: Function-invocation | Operands: Character | Output: X2A('hexstring') converts a character string argument containing | hexadecimal digits to an arithmetic value. | If the character string contains fewer than 8 characters, it is padded | internally on the left with '' characters. | Error conditions are detected if the argument contains invalid characters, | or if the argument length exceeds 8 characters, generating the message | ASMA214E. | Null argument strings return zero. | The result of the X2A function is the same as | &value SETA X'hexstring' | except that null strings are allowed by X2A but not by SETA. | Examples | X2A('11') has value 257 | X2A('C1') has value 193 | X2A('') has value | X2A('FFFFFFF') has value -16 XOR Format: Logical-expression Operands: Arithmetic Output: Each bit position in the result is set to 1 if the corresponding bit positions in the two operands are unlike, otherwise the result bit is set to 0. Example After the following statements &VAR contains the arithmetic value +8. Name Operation Operand &OP1 SETA 1 &OP2 SETA 2 &VAR SETA (&OP1 XOR &OP2) Rules for Coding Arithmetic Expressions: The following is a summary of coding rules for arithmetic expressions: 1. Unary (operating on one value) operators and binary (operating on two values) operators are allowed in arithmetic expressions. 2. An arithmetic expression can have one or more unary operators preceding any term in the expression or at the beginning of the expression. The unary operators are + (positive) and − (negative). 3. The binary operators that can be used to combine the terms of an expression are + (addition), − (subtraction), (multiplication), and / (division). 4. An arithmetic expression must not begin with a binary operator, and it must not contain two binary operators in succession. 358 HLASM V1R5 Language Reference
SETA Instruction 5. An arithmetic-valued function is a term. 6. An arithmetic expression must not contain two terms in succession. 7. An arithmetic expression must not contain a decimal point. For example, 123.456 is not a valid arithmetic term, but 123 is. 8. An arithmetic expression must not contain spaces between an operator and a term, nor between two successive operators except for built-in functions using the “logical-expression format” described at “Logical (SETB) Expressions” on page 365. 9. Ordinary symbols specified in arithmetic expressions must be defined before the arithmetic expression is encountered, and must have an absolute value. 10. An arithmetic expression can contain up to 24 unary and binary operators, and is limited to 255 levels of parentheses. The parentheses required for sublist notation, substring notation, and subscript notation count toward this limit. An arithmetic expression must not contain two terms in succession; however, any term may be preceded by up to 24 unary operators. +&A−&B is a valid operand for a SETA instruction. The expression &FIELD+− is invalid because it has no final term. Evaluation of Arithmetic Expressions: The assembler evaluates arithmetic expressions during conditional assembly processing as follows: 1. It evaluates each arithmetic term. 2. It carries out arithmetic operations from left to right. However, a. It carries out unary operations before binary operations, and b. It carries out the binary operations of multiplication and division before the binary operations of addition and subtraction. 3. In division, it gives an integer result; any fractional portion is dropped. Division by zero gives a 0 result. 4. In parenthesized arithmetic expressions, the assembler evaluates the innermost expressions first, and then considers them as arithmetic terms in the next outer level of expressions. It continues this process until the outermost expression is evaluated. 5. The computed result, including intermediate values, must lie in the range −2 31 | through +2 31 −1. (Note that if the value −2 31 is substituted in a SETC | expression, its magnitude, 2147483648, is invalid if subsequently substituted in | a SETA expression.) SETC Variables in Arithmetic Expressions: The assembler permits a SETC variable to be used as a term in an arithmetic expression if the character string value of the variable is a self-defining term. The value represented by the string is assigned to the arithmetic term. A null string is treated as zero. Examples: LCLC &C(5) &C(1) SETC 'B''11''' &C(2) SETC 'C''A''' &C(3) SETC '23' &A SETA &C(1)+&C(2)–&C(3) Chapter 9. How to Write Conditional Assembly Instructions 359
- Page 328 and 329: Values in Operands Notes: 1. Spaces
- 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 380 and 381: SETA Instruction In evaluating the
- 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
SETA Instruction<br />
5. An arithmetic-valued function is a term.<br />
6. An arithmetic expression must not contain two terms in succession.<br />
7. An arithmetic expression must not contain a decimal point. For example,<br />
123.456 is not a valid arithmetic term, but 123 is.<br />
8. An arithmetic expression must not contain spaces between an operator and a<br />
term, nor between two successive operators except for built-in functions using<br />
the “logical-expression format” described at “Logical (SETB) Expressions” on<br />
page 365.<br />
9. Ordinary symbols specified in arithmetic expressions must be defined before<br />
the arithmetic expression is encountered, and must have an absolute value.<br />
10. An arithmetic expression can contain up to 24 unary and binary operators, and<br />
is limited to 255 levels of parentheses. The parentheses required for sublist<br />
notation, substring notation, and subscript notation count toward this limit.<br />
An arithmetic expression must not contain two terms in succession; however,<br />
any term may be preceded by up to 24 unary operators. +&A−&B is a valid<br />
operand for a SETA instruction. The expression &FIELD+− is invalid because it<br />
has no final term.<br />
Evaluation of Arithmetic Expressions: The assembler evaluates arithmetic<br />
expressions during conditional assembly processing as follows:<br />
1. It evaluates each arithmetic term.<br />
2. It carries out arithmetic operations from left to right. However,<br />
a. It carries out unary operations before binary operations, and<br />
b. It carries out the binary operations of multiplication and division before the<br />
binary operations of addition and subtraction.<br />
3. In division, it gives an integer result; any fractional portion is dropped. Division<br />
by zero gives a 0 result.<br />
4. In parenthesized arithmetic expressions, the assembler evaluates the innermost<br />
expressions first, and then considers them as arithmetic terms in the next outer<br />
level of expressions. It continues this process until the outermost expression is<br />
evaluated.<br />
5. The computed result, including intermediate values, must lie in the range −2 31<br />
| through +2 31 −1. (Note that if the value −2 31 is substituted in a SETC<br />
| expression, its magnitude, 2147483648, is invalid if subsequently substituted in<br />
| a SETA expression.)<br />
SETC Variables in Arithmetic Expressions: The assembler permits a SETC<br />
variable to be used as a term in an arithmetic expression if the character string<br />
value of the variable is a self-defining term. The value represented by the string is<br />
assigned to the arithmetic term. A null string is treated as zero.<br />
Examples:<br />
LCLC<br />
&C(5)<br />
&C(1) SETC 'B''11'''<br />
&C(2) SETC 'C''A'''<br />
&C(3) SETC '23'<br />
&A SETA &C(1)+&C(2)–&C(3)<br />
Chapter 9. How to Write Conditional Assembly Instructions 359