3. Embedded QUEL for COBOL : COBOL Variables and Data Types : Variable and Type Declarations : Data Item Declaration Syntax
 
Share this page                  
Data Item Declaration Syntax
This section describes rules and restrictions for declaring EQUEL/COBOL data items. EQUEL recognizes only a subset of legal COBOL declarations.
The following template is the complete data item declaration format that EQUEL/COBOL accepts:
level-number
             [data-name | FILLER]
             [ REDEFINES data-item]
             [ [ISGLOBAL]
             [ [ISEXTERNAL]
             [ PICTURE [ISpic-string ]
             [ [USAGE [IS]] use-type ]
             [ SIGN clause ]
             [ SYNCHRONIZED clause ]
             [ JUSTIFIED clause ]
             [ BLANK clause ]
             [ VALUE clause ]
             [ OCCURS clause ] .
Syntax Notes:
Data declaration clauses can be in any order, with the following two exceptions:
The data-name or FILLER clause, if given, must immediately follow the level number.
The REDEFINES clause, if given, must immediately follow the data-item or FILLER clause.
The level-number can range from 01 to 49. Level number 77 (for noncontiguous data items) is also valid and the preprocessor regards it as identical to level 01. The EQUEL/COBOL preprocessor does not support levels 66 (which identifies RENAMES items) and 88 (which associates condition names with values).
Follow the COBOL rules for specifying the organization of data when you assign level numbers to your EQUEL data items. Like the COBOL compiler, the preprocessor recognizes that a data item belongs to a record or group if its level number is greater than the record or group level number.
The data-name must begin with an alphabetic character or an underscore, which can be followed by alphanumeric characters, hyphens, and underscores. The word FILLER may appear in place of data-name; however, you cannot explicitly reference a FILLER item in an EQUEL statement. If the data-name or FILLER clause is omitted, FILLER is the default.
The preprocessor accepts but does not use the REDEFINES, GLOBAL, EXTERNAL, SIGN, SYNCHRONIZED, JUSTIFIED, BLANK, and VALUE clauses. Consequently, illegal use of these clauses goes undetected at preprocess time but generates COBOL errors later at compile time. For example, the preprocessor does not check that a GLOBAL clause appears only on an 01 level item, nor that a SIGN clause appears only on a numeric item.
The preprocessor expects a PICTURE clause on the COMP, COMP-3, COMP-5 (UNIX only) and DISPLAY use-types.
Do not use a PICTURE clause on INDEX use-types and on the UNIX COMP-1 and COMP-2 use-types.
Although the preprocessor recognizes all the valid COBOL PICTURE symbols, it only makes use of the type and size information needed for runtime support. It does not, for instance, complain about certain illegal combinations of editing symbols in picture strings. EQUEL accepts PIC as an abbreviation for PICTURE. You must specify the picture string on the same line as the keyword PICTURE.
For a description of the valid use-types for the USAGE clause and their interaction with picture strings, see Data Types.
The preprocessor accepts the OCCURS clause for all data items in the level range 02 through 49. The preprocessor does not use the information in the OCCURS clause, except to note that the item described is an array. If you use an OCCURS clause on level 01, the preprocessor issues an error but generates correct code so that you can compile and link the program.