References to DATA DIVISION names
This section discusses the following types of references.
Simple data reference
The most basic method of referencing data items in a COBOL program is simple data reference, which is data-name-1 without qualification, subscripting, or reference modification. Simple data reference is used to reference a single elementary or group item.
- data-name-1
- Can be any data description entry.
data-name-1 must be unique in a program.
Identifiers
When used in a syntax diagram in this information, the term identifier refers to a valid combination of a data-name or function-identifier with its qualifiers, subscripts, and reference-modifiers as required for uniqueness of reference.
Rules for identifiers associated with a format can however specifically prohibit qualification, subscripting, or reference modification.
The term data-name refers to a name that must not be qualified, subscripted, or reference modified unless specifically permitted by the rules for the format.
- For a description of qualification, see Qualification.
- For a description of subscripting, see Subscripting.
- For a description of reference modification, see Reference modification.
- data-name-1 , data-name-2
- Can be a record-name.
- file-name-1
- Must
be identified by an FD or SD entry in the DATA DIVISION.
file-name-1 must be unique within this program.
- data-name-1 , data-name-2
- Can be a record-name.
- condition-name-1
- Can be referenced by statements and entries either in the program that contains the configuration section or in a program contained within that program.
- file-name-1
- Must be identified by an FD or SD entry in the DATA DIVISION.
Must be unique within this program.
- LINAGE-COUNTER
- Must be qualified each time it is referenced if more than one file description entry that contains a LINAGE clause has been specified in the source unit.
- file-name-2
- Must be identified by the FD or SD entry in the DATA DIVISION. file-name-2 must be unique within this program.
Duplication of data-names must not occur in those places where the data-names cannot be made unique by qualification.
In the same program, the data-name specified as the subject of the entry whose level-number is 01 that includes the EXTERNAL clause must not be the same data-name specified for any other data description entry that includes the EXTERNAL clause.
In the same DATA DIVISION, the data description entries for any two data items for which the same data-name is specified must not include the GLOBAL clause.
DATA DIVISION names that are explicitly referenced must either be uniquely defined or made unique through qualification. Unreferenced data items need not be uniquely defined. The highest level in a data hierarchy (a data item associated with a level indicator (FD or SD in the FILE SECTION) or with level-number 01) must be uniquely named if referenced. Data items associated with level-numbers 02 through 49 are successively lower levels of the hierarchy.