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


Evaluation of expressions

HLASM Language Reference
SC26-4940-06

A single-term expression, like 29 or BETA, has the value of the term involved. The assembler reduces a multiterm expression, like 25*10+A/B or BETA+10, to a single value, as follows:
  1. It evaluates each term.
  2. It does arithmetic operations from left to right. However:
    1. It does unary operations before binary operations.
    2. It does 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 0.
  4. In parenthesized expressions, the assembler evaluates the innermost expressions first and then considers them as terms in the next outer level of expressions. It continues this process until the outermost expression is evaluated.
  5. A term or expression's intermediate value and computed result must lie in the range of -231 through +231-1.

The assembler evaluates paired relocatable terms at each level of expression nesting.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014