HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Evaluation of arithmetic expressions

HLASM Language Reference
SC26-4940-06

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,
    1. It carries out unary operations before binary operations.
    2. It carries out the binary operations of multiplication and division before the binary operations of addition and subtraction.
    3. It carries out the binary operations of addition and subtraction before the bitwise logical operations.
    4. It carries out the bitwise logical operations before shift operations.
  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 -231 through +231-1. (If the value -231 is substituted in a SETC expression, its magnitude, 2147483648, is invalid if substituted in a SETA expression.)

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014