contents.gifindex.gifprev1.gifnext1.gif

5.1.2 Level-Numbers

Level-numbers are used to describe the hierarchical organization of a record. Level-numbers that describe this hierarchy range from 01 through 49.

The topmost data item is the record. It always has a level-number of 01. Items that are included in the record have greater (although not necessarily consecutive) level-numbers.

All items subordinate to a group item must have level-numbers greater than the group's level-number. The end of a group item is delimited by the next data description entry that has a level-number less than or equal to the group's level-number.

Four special level-numbers are used to specify special types of data. They are never used in a hierarchical structure. Instead, they define the following special types:

gt490000.gif Level-number 66 identifies a RENAMES item which regroups other data items.

gt490000.gif Level-number 77 identifies an elementary data item in the Working-Storage or Linkage sections. These are essentially identical to a level 01 elementary data item. The level-number is used to emphasize that the data item is not part of a hierarchy and cannot itself be subdivided.

gt490000.gif Level-number 78 associates a value with the name of a constant.

gt490000.gif Level-number 88 identifies a condition-name and its values.

The following example shows how level-numbers define a record's hierarchy and shows how records, groups, and elementary items interact. The items are indented to display the hierarchy. This is a recommended programming practice but is not required by COBOL.

01  EMPLOYEE-RECORD. (record)

03 EMPLOYEE-KEY. (group)
05 DEPARTMENT-CODE (elementary)
05 EMPLOYEE-NUMBER (elementary)
03 EMPLOYEE-IDENTIFICATION. (group)
05 EMPLOYEE-NAME (elementary)
05 EMPLOYEE-ADDRESS. (group)
07 STREET-ADDRESS-1 (elementary)
07 STREET-ADDRESS-2 (elementary)
07 CITY (elementary)
07 STATE (elementary)
07 ZIP-CODE (elementary)
05 EMPLOYEE-RACE (elementary)
05 MARRIAGE-STATUS (elementary)
03 PAYROLL-INFORMATION. (group)
05 SALARY (elementary)
05 PAY-FREQUENCY (elementary)
05 DEDUCTION-CODE-1 (elementary)
05 DEDUCTION-CODE-2 (elementary)
05 SICK-ACCRUAL-RATE (elementary)
05 VACATION-ACCRUAL-RATE (elementary)