Chapter 3: Expressions


Support for expressions in RPG IV extends normal conditional logic, keyword support, and calculations through the use of natural expressions. Natural expressions are used to simplify the programming of these components as well as the implementation of traditional business rules. Expressions can be used with conditional logic statements, assignment statements, or embedded as a parameter of a procedure. An expression matching the data type of a procedure's parameter can be specified as a paramenter for the procedure, provided that the parameter is specified as being CONST or passed by VALUE. Unlike prior versions of RPG, the RETURN operation accepts expressions in the extended factor 2.

EXPRESSIONS in RPG

Expressions are used in the following areas of an RPG program:

  • Declaration. Most definition specification keywords support expressions. This support provides referential referencing of related data items defined in the program and simplifies initialization of data items.

  • Assignment. The calculation specification EVAL and EVALR operations fully support expressions of every type. Expressions can appear, in the assignment statements of the EVAL and EVALR operations, on either side of the = (equals) sign.

  • Comparison. The conditional operations of the calculation specification include IF, WHEN, DOW, DOU, and FOR. These operations fully support conditional expressions. Note that assignment is never performed by conditional operations.

  • Procedures. The CALLP and RETURN operations support expressions or parameters specified in factor 2.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net