EVALUATE statement
The EVALUATE statement provides a shorthand notation for a series of nested IF statements. The EVALUATE statement can evaluate multiple conditions. The subsequent action depends on the results of these evaluations.
- Operands before the WHEN phrase
- Are interpreted in one of two ways, depending on how they are
specified:
- Individually, they are called selection subjects.
- Collectively, they are called a set of selection subjects.
- Operands in the WHEN phrase
- Are interpreted in one of two ways, depending on how they are
specified:
- Individually, they are called selection objects
- Collectively, they are called a set of selection objects.
- ALSO
- Separates selection subjects within a set of selection subjects; separates selection objects within a set of selection objects.
- THROUGH and THRU
- Are equivalent.
Two operands connected by a THRU phrase must be of the same class. The two operands thus connected constitute a single selection object.
The number of selection objects within each set of selection objects must be equal to the number of selection subjects.
Each selection object within a set of selection objects must correspond to the selection subject having the same ordinal position within the set of selection subjects, according to the following rules:
- Identifiers, literals, or arithmetic expressions appearing within a selection object must be valid operands for comparison to the corresponding operand in the set of selection subjects. For comparisons involving date fields, see Comparison of date fields.
- condition-1, condition-2, or the word TRUE or FALSE appearing as a selection object must correspond to a conditional expression or the word TRUE or FALSE in the set of selection subjects.
- The word ANY can correspond to a selection subject of any type.
END-EVALUATE phrase
This explicit scope terminator serves to delimit the scope of the EVALUATE statement. END-EVALUATE permits a conditional EVALUATE statement to be nested in another conditional statement.
For more information, see Delimited scope statements.