Condition-Name Condition

A condition-name condition tests a conditional variable to determine whether its value is equal to any value(s) associated with the condition-name.

Read syntax diagramSkip visual syntax diagram
Condition-Name Condition - Format

>>-condition-name----------------------------------------------><

A condition-name is used in conditions as an abbreviation for the relation condition. The rules for comparing a conditional variable with a condition-name value are the same as those specified for relation conditions.

If the condition-name has been associated with a range of values (or with several ranges of values), the conditional variable is tested to determine whether or not its value falls within the range(s), including the end values. The result of the test is true if one of the values corresponding to the condition-name equals the value of its associated conditional variable.

IBM Extension

IBM Extension Start of changeCondition-names with floating-point, NATIONAL, and DBCS values are allowed.End of change End of IBM Extension

End of IBM Extension
The following example illustrates the use of conditional variables and condition-names:
01  NUMBER               PIC  99.
    88  FIVE             VALUE 5.
    88  ONE-DIGIT-EVEN   VALUE 0, 2, 4, 6, 8
    88  TWO-DIGIT-NUMBER VALUE 10 THRU 99

NUMBER is the conditional variable; FIVE, ONE-DIGIT-EVEN, TWO-DIGIT-NUMBER are condition-names.

The following IF statements can be added to the above example to determine the age group of a specific record:
IF FIVE...             (Tests for value 5)
IF ONE-DIGIT-EVEN      (Tests for values 0, 2, 4, 6, 8)
IF TWO-DIGIT-NUMBER    (Tests for values 10 thru 99)

Depending on the evaluation of the condition-name condition, alternative paths of execution are taken by the object program.