Levels of data in a record description entry
Each group and elementary item in a record requires a separate entry, and each must be assigned a level-number.
A level-number is a one-digit or two-digit integer between 01 and 49, or one of three special level-numbers: 66, 77, or 88. The following level-numbers are used to structure records:
- 01
- This level-number specifies the record itself, and is the most inclusive level-number possible. A level-01 entry can be an alphanumeric group item, a national group item, or an elementary item. The level number must begin in Area A.
- 02 through 49
- These level-numbers specify group and elementary items within a record. They can begin in Area A or Area B. Less inclusive data items are assigned higher (not necessarily consecutive) level-numbers in this series.
The relationship between level-numbers within a group item defines the hierarchy of data within that group.
A group item includes all group and elementary items that follow it until a level-number less than or equal to the level-number of that group is encountered.
The following figure illustrates a group wherein all groups immediately subordinate to the level-01 entry have the same level-number.
You
can also define groups with subordinate items that have different
level-numbers for the same level in the hierarchy. For example, 05
EMPLOYEE-NAME
and 04 EMPLOYEE-ADDRESS
in
EMPLOYEE-RECORD
below define the same level in the
hierarchy. The compiler renumbers the levels in a relative
fashion, as shown in MAP output.
01 EMPLOYEE-RECORD.
05 EMPLOYEE-NAME.
10 FIRST-NAME PICTURE X(10).
10 LAST-NAME PICTURE X(10).
04 EMPLOYEE-ADDRESS.
08 STREET PICTURE X(10).
08 CITY PICTURE X(10).
The following record description entry defines the same data hierarchy as the preceding record description entry:
01 EMPLOYEE-RECORD.
02 EMPLOYEE-NAME.
03 FIRST-NAME PICTURE X(10).
03 LAST-NAME PICTURE X(10).
02 EMPLOYEE-ADDRESS.
03 STREET PICTURE X(10).
03 CITY PICTURE X(10).
Elementary items can be specified at any level within the hierarchy.