Function
A data description entry describes the attributes of a single data item.
Format 1
level-number
[data-name | FILLER]
[REDEFINES clause]
[ANY LENGTH clause]
[BASED clause]
[BLANK WHEN ZERO clause]
[DYNAMIC clause]
[EXTERNAL clause]
[GLOBAL clause]
[GROUP-USAGE clause]
[JUSTIFIED clause]
[OCCURS clause]
[PICTURE clause]
[SIGN clause]
[SYNCHRONIZED clause]
[TYPE clause]
[TYPEDEF clause]
[USAGE clause]
[VALUE clause]
Syntax rules
level-number must be a number from 01 through 49 or 77.
Descriptions of level 77 specify data items that are not hierarchically related and are not subdivided into smaller parts.
The clauses may be written in any order, except for the FILLER and data-name phrases and the REDEFINES and TYPEDEF clauses. The FILLER or data-name phrase must directly follow the level number. If the REDEFINES clause if specified, it must be the first clause ahead of all other clauses. The TYPEDEF clause may not be specified together with the REDEFINES clause. If the TYPEDEF clause is specified, it must follow immediately after the level number and data-name phrase.
The PICTURE clause must not be specified for elementary items that are defined with USAGE COMP-1, COMP-2, INDEX, OBJECT REFERENCE, POINTER or PROGRAM-POINTER. The PICTURE clause must be specified for all other elementary items, with the following exception:
The PICTURE clause need not be specified for an elementary item if a VALUE clause of format 1 is specified with an alphanumeric or national literal and it is not followed by an entry with the level number 88.
The compiler then assumes a PICTURE clause PICTURE X(length) or PICTURE N(length), where length is the number of characters represented by the literal.The OCCURS clause must not be specified in a data description entry that has a level-number of 01, 66, 77 or 88.
If the ANY LENGTH clause is specified, then only the PICTURE clause and USAGE clause may be specified in addition to the level number and data name.
The following specifications are required in each data description entry
data-name
the PICTURE clause
orthe USAGE clause with the INDEX, COMPUTATIONAL-1, COMPUTATIONAL-2, OBJECT-REFERENCE, POINTER or PROGRAM-POINTER
ora VALUE clause with an alphanumeric or national literal or a TYPE clause
Example 7-1
for the structure of a record with description of group items
01 DATA-RECORD. ———————————————— Logical record 02 REF-NO PIC ... ——————————— Elementary item 02 CUSTMR-NO PIC ... ———————— Elementary item 02 MAILING-ADDRESS. ————————— Group item | 03 FIRST-NAME PIC ... ———— Elementary item | 03 LAST-NAME PIC ... ————— Elementary item | 03 STATE PIC ... ————————— Elementary item | Group item 03 CITY. ————————————————— Group item | | 04 ZIP-CODE PIC ... ——— Elementary item | Group item | 04 CITY-NAME PIC ... —— Elementary item | | 03 STREET PIC ... ———————— Elementary item | 02 ART-NO PIC ... ——————————— Elementary item 02 PRICE. ——————————————————— Group item | 03 DOMES PIC ... ————————— Elementary item | Group item 03 FORGN PIC ... ————————— Elementary item |
The group item contains no information on data class or size of item. Definitions (e.g. REDEFINES, OCCURS) can, however, follow the group item name. The entry ends with a period.
Format 2
66 data-name-1 RENAMES data-name-2 [{THROUGH | THRU} data-name-3].
For syntax rules and general rules, see section "RENAMES clause".
Format 3
88 condition-name {VALUE | VALUES} {IS | ARE} {literal-1 [{THROUGH | THRU}
literal-2
]}...
For syntax rules and general rules, see “Format 2” in section "VALUE clause".