Level-number

The level-number of a data item shows the hierarchy of that data item within its logical record. It is also used to denote individual data items and condition names.

Syntax Rules

  1. Data description entries subordinate to an FD entry must have level-numbers with the values 01 through 49, 66, 78, or 88.
  2. Data description entries in Working-Storage may have level-numbers with the values 01 through 49, 66, 77, 78, or 88.
  3. Data description entries in Linkage may have level-numbers with the values 01 through 49, 66, 77, 78, or 88.

General Rules

  1. The level-number 01 indicates the first entry in a record description.
  2. Each data description entry in a record description can be subdivided into multiple data description entries, each having the same level-number. This level-number must be greater than the level-number of the subdivided entry, but less than 50. These level-numbers do not have to be successive. Thus you construct a record hierarchy of data items by using level-numbers.
  3. An elementary data item may not be immediately followed by a data item with a higher level-number (except for levels 66, 77, 78, and 88).
  4. Multiple level 01 entries subordinate to a file description entry represent implicit redefinitions of the same area.
  5. Level-number 66 may be used to identify only RENAMES entries (Format 2 data description entry).
  6. Level-number 77 identifies a non-contiguous data item entry. Level-number 77 entries may not have subordinate data description entries except for level 88 items.
  7. A level 78 entry associates a value with the name of a constant. The name of the constant can be used anywhere the corresponding literal can be used.
  8. You may use a level 78 named constant as a repeat count in a PICTURE string. This means that, in a PICTURE string, you may substitute a level 78 for a number in parentheses. In the following example, DATA-1 and DATA-2 are both the same size:
        78  LENG-20     VALUE 20.
        01  DATA-1      PIC X(20).
        01  DATA-2      PIC X(LENG-20).

    The PICTURE string that results from the substitution of the level 78 for its value must be legal. Use this in programs when several data items must be the same size and you want to be able to easily change the size in the future.

  9. Level-number 88 defines a condition name. It can be used only in a Format 4 data description entry.