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.

Format

Read syntax diagramSkip visual syntax diagramEVALUATEidentifier-1literal-1expression-1TRUEFALSE ALSOidentifier-2literal-2expression-2TRUEFALSEWHENphrase 1ALSOphrase 2imperative-statement-1WHEN OTHERimperative-statement-2END-EVALUATE
phrase 1
Read syntax diagramSkip visual syntax diagramANYcondition-1TRUEFALSENOTidentifier-3literal-3arithmetic-expression-1THROUGHTHRUidentifier-4literal-4arithmetic-expression-2
phrase 2
Read syntax diagramSkip visual syntax diagramANYcondition-2TRUEFALSENOTidentifier-5literal-5arithmetic-expression-3THROUGHTHRUidentifier-6literal-6arithmetic-expression-4

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.

All identifiers in the EVALUATE statement must not be dynamic-length group items.

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.
  • 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.