Every user-defined name explicitly referenced in a COBOL program must be uniquely defined in one of these ways:
- No other name has the same spelling and hyphenation.
- The name is unique within the context of a REDEFINES clause.
- The name exists within a hierarchy of names, and reference to the name can be made unique by mentioning one or more of the
higher level names in the hierarchy.
These higher-level names are called qualifiers. Identical user-defined names may appear in a source program; however, uniqueness
must then be established through qualification for each user-defined name explicitly referenced. All available qualifiers
need not be referenced as long as uniqueness is established.
General Format
Format 1
{data-name-1} { {OF} name-2 } ... [ {OF} file-name ]
{cond-name } {IN} {IN}
Format 2
{data-name-1} {OF} file-name
{cond-name } {IN}
Format 3
paragraph-name {OF} section-name
{IN}
Format 4
lib-name {OF} dir-name
{IN}
Format 5
LINAGE-COUNTER {OF} file-name
{IN}
Syntax Rules
- For each non-unique user-defined name that is explicitly referenced, uniqueness must be established through a sequence of
qualifiers that precludes any ambiguity.
- A name may be qualified even though it does not need qualification.
- IN and OF are equivalent.
- In Format 1, each qualifier must be the name associated with a group item to which the item being qualified is subordinate,
or the name of a condition-variable with which the condition-name being qualified is associated. Qualifiers are specified in the order of successively more inclusive levels in the hierarchy.
- If the program contains explicit references to a paragraph-name, the paragraph-name cannot appear more than once in the same section. A paragraph-name need not be qualified in a reference from within the same section that contains paragraph-name.
- The LINAGE phrase of a file's FD creates an implicit data item called LINAGE-COUNTER. If more than one file in a program contains
a LINAGE phrase, then reference to a file's LINAGE-COUNTER must be qualified by the name of the file.
- If both qualification and subscripting are used in a data reference, the qualification is done first.
- If both qualification and reference modification are used in a data reference, the qualification is done first.
- A Format 4 form of qualification is used with the COPY statement. It is described in that section.