General Expression Rules

The following are general rules that apply to all expressions:

  1. Expressions are coded in the Extended-Factor 2 entry on the Calculation Specification or after the operation code on a free-form calculation.
  2. An expression can be continued on more than one specification. On a continuation specification, the only entries allowed are C in column 6 and the Extended-Factor 2 entry.

    No special continuation character is needed unless the expression is split within a literal or a name.

  3. Blanks (like parentheses) are required only to resolve ambiguity. However, they may be used to enhance readability.

    Note that RPG will read as many characters as possible when parsing each token of an expression. For example,

  4. The TRUNCNBR option (as a command parameter or as a keyword on a control specification) does not apply to calculations done within expressions. When overflow occurs during an expression operation, an exception is always issued.


[ Top of Page | Previous Page | Next Page | Contents | Index ]