3. Embedded QUEL for COBOL : COBOL Variables and Data Types : Data Types : Declaring Records
 
Share this page                  
Declaring Records
EQUEL/COBOL accepts COBOL record and group declarations. The following syntax declares a record:
01 data-name.
        record-item.
        {record-item.}
where record-item is a group item:
level-number data-name.
        record-item.
        {record-item.}
or an elementary item:
level-number data-name elementary-item-description.
Syntax Notes:
The record must have a level number of 01. Thereafter, the level numbers of record-items can be 02 through 49. The preprocessor applies the same rules as the COBOL compiler in using the level numbers to order the groups and elementary items in a record definition into a hierarchical structure.
If you do not specify the elementary-item-description for a record item, the record item is assumed to be a group item.
The elementary-item-description can consist of any of the attributes described for data declarations (see Data Item Declaration Syntax). The preprocessor does not confirm that the different clauses are acceptable for record items.
The OCCURS clause, denoting a COBOL table, may appear on any record item.
Only record-items that EQUEL statements reference need to be declared to EQUEL. The following example declares a COBOL record with several "filler" record-items that are not declared to EQUEL:
##   01   PERSON-REC.
##        02   NAME.
##             03    FIRST-NAME      PIC X(10).
               03    FILLER          PIC X.
##             03    LAST-NAME       PIC X(15).
##        02   STREET-ADDRESS.
##             03    ST-NUMBER       PIC 99999 DISPLAY.
               03    FILLER          PIC X.
##             03    STREET          PIC X(30).
##        02   TOWN-STATE.
##             03    TOWN            PIC X(20).
               03    FILLER          PIC X. 
##             03    STATE           PIC X(3).
               03    FILLER          PIC X.
##             03    ZIP             PIC 99999 DISPLAY.