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


Rules for coding arithmetic expressions

HLASM Language Reference
SC26-4940-06

Here 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.
  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.
  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 can 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.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014