Condition-Name Level 88

Level-number 88 designates a condition-name entry. Level 88s are used to assign names to values at execution time. Thus, a condition-name is not the name of an item, but rather the name of a value. A level 88 doesn't reserve any storage area.

Each level 88 must be associated with a data item and must immediately follow that item in the Data Division. The associated data item is called a condition-variable. A level 88 may name a specific value, a set of values, or a range of values. For example:

05  student-status    pic 9(2).
    88  kindergarten  value 0.
    88  elementary    values are 1 through 6.
    88  jr-high       values 7, 8, 9.
    88  high-school   values are 10 through 12.

Condition-names are often used in the Procedure Division as a test (usually with an IF statement) to specify conditions under which control will pass to another part of the program. They can make sentences much more meaningful to the reader. For example, if you've defined the condition-names shown above, then you could write this code:

if kindergarten
    perform assign-half-day-schedule. 

without the condition-name, you would have to write:

if student-status = "0"
    perform assign-half-day-schedule.

If you defined this condition-name:

07 priority-code        pic x.
   88 highest-priority  value "d".

then you could write this easily understood code:

if highest-priority perform fill-order-at-once.

without the condition-name, you would have to write:

if priority-code = "d" perform fill-order-at-once.

Thus, real benefit comes from choosing a meaningful name for each value or set of values.

Setting a condition-name to TRUE is equivalent to moving any one of its values to the associated condition-variable. For example, note how the SET verb is used below to establish the truth of the condition:

05  end-of-shipping-file    pic x value "n".
    88  no-more-shipments   value "y".

...

perform process-daily-arrivals 
  until no-more-shipments.

...

read shipping-file 
  at end set no-more-shipments to true.

The same result could have been achieved with this code:

read shipping-file 
  at end move "y" to end-of-shipping-file.

If explicitly referenced, a condition-name must be unique or must be made unique through qualification or subscripting. If qualification is used to make a condition-name unique, the associated condition-variable may be used as the first qualifier. The hierarchy of names associated with the condition-variable may be used in further qualification. If references to a condition-variable require subscripting, then references to the associated condition-name also require the same combination of subscripting.

For more information about condition-names, see Data Description Entry, VALUE Clause, and the SET Statement.