Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

5.1.6.2 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 1- or 2-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 either a group item or an elementary item. It must begin in Area A.

02-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.

A group item includes all group and elementary items following it, until a level-number less than or equal to the level-number of this group is encountered.

All elementary or group items immediately subordinate to one group item must be assigned identical level-numbers higher than the level-number of this group item.

Figure 4 illustrates the concept. Note that all groups immediately subordinate to the level-01 entry have the same level-number. Note also that elementary items from different subgroups do not necessarily have the same level numbers, and that elementary items can be specified at any level within the hierarchy.



The COBOL record description entry written as follows is subdivided as indicated below:

01 RECORD_ENTRY. ______This entry includes_______ | 05 GROUP_1. ______This entry includes_____ | | | 10 SUBGROUP_1. ________This entry includes___ | | | | | 15 ELEM_1 PIC... . | | | 15 ELEM_2 PIC... .  | | | | 10 SUBGROUP_2. ________This entry includes___ | | | | | 15 ELEM_3 PIC... . | | | 15 ELEM_4 PIC... .   | | 05 GROUP_2. ________This entry includes___ | | | 15 SUBGROUP_3. _________This entry includes_____ | | | | | 25 ELEM_5 PIC... . | | | 25 ELEM_6 PIC... .  | | | | 15 SUBGROUP_4 PIC... . This entry includes itself.  | | 05 ELEM_7 PIC... . This entry includes itself. 

The storage arrangement of the record description entry is illustrated below:

|______________________________RECORD_ENTRY______________________________ÿ| | | | | |___________GROUP_1______________ÿ|______________GROUP_2_______ÿ| | | | | | |__SUBGROUP_1__ÿ|__SUBGROUP_2___ÿ|____SUBGROUP_3_ÿ| | |

_______ ________ ________ ________ ________ ________ ____________ ________ |ELEM_1 | ELEM_2 | ELEM_3 | ELEM_4 | ELEM_5 | ELEM_6 | SUBGROUP_4 | ELEM_7 | |_______|________|________|________|________|________|____________|________|


Figure 4. Levels in a Record Description



X IBM COBOL accepts nonstandard level-numbers that are not identical to
X others at the same level. For example, the following two record
X description entries are equivalent:


          01   EMPLOYEE-RECORD.
               05  EMPLOYEE-NAME.
                   10  FIRST-NAME PICTURE  X(10).
                   10  LAST-NAME  PICTURE  X(10).
               05  EMPLOYEE-ADDRESS.
                   10  STREET     PICTURE  X(10).
                   10  CITY       PICTURE  X(10).
 X        01   EMPLOYEE-RECORD.
 X             05  EMPLOYEE-NAME.
 X                 10  FIRST-NAME PICTURE  X(10).
 X                 10  LAST-NAME  PICTURE  X(10).
 X             04  EMPLOYEE-ADDRESS.
 X                 08  STREET     PICTURE  X(10).
 X                 08  CITY       PICTURE  X(10).


Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.