A name can be made unique if it exists within a hierarchy of names, and the name can be identified by specifying one or more higher-level names in the hierarchy. The higher-level names are called qualifiers, and the process by which such names are made unique is called qualification.
Qualification is specified by placing one or more phrases after a user-specified name, with each phrase made up of the word IN or OF followed by a qualifier. (IN and OF are logically equivalent.)
References to Data Division Names - Format 1
.-------------------------.
V |
>>-+-data-name-1----+----+---------------------+-+-------------->
'-condition-name-' '-+-IN-+--data-name-2-'
'-OF-'
>--+---------------------+-------------------------------------><
'-+-IN-+--file-name-1-'
'-OF-'
References to Data Division Names - Format 2
>>-LINAGE-COUNTER--+---------------------+---------------------><
'-+-IN-+--file-name-2-'
'-OF-'
In any hierarchy, the data name associated with the highest level must be unique, and cannot be qualified.
You must specify enough qualification to make the name unique; however, it may not be necessary to specify all the levels of the hierarchy. For example, if there is more than one file whose records contain the field EMPLOYEE-NO, but only one of the files has a record named MASTER-RECORD:
Related Information:
Data Division names that are explicitly referenced in a program must be either uniquely defined, or made unique through qualification. Unreferenced data-names need not be uniquely defined.
A data-name associated with a level-number 01, or with an FD or SD level indicator in the File Section, is the highest level in a data hierarchy. If referenced, it must be uniquely defined, because it cannot be qualified. Data items with level-numbers 02 through 49 are successively lower levels in a data hierarchy, and if referenced, must be either uniquely defined, or made unique through qualification. Level-77 data-names, if referenced, must be uniquely defined, because they cannot be qualified.
If explicitly referenced, a paragraph-name must not be duplicated within a section. When a paragraph-name is qualified by a section-name, the word SECTION must not appear. A paragraph-name need not be qualified when referred to within the section in which it appears. A paragraph-name or section-name appearing in a program cannot be referenced from any other program. A section-name, described in Section, is the highest (and only) qualifier available for a paragraph-name and must be unique.
References to Procedure Division Names - Format 1
>>-paragraph-name--+----------------------+--------------------><
'-+-IN-+--section-name-'
'-OF-'
References to Procedure Division Names - Format 2 >>-section-name------------------------------------------------><
If more than one COBOL library is available to the compiler during compilation, text-name can be qualified each time it is referenced.
References to COPY Libraries - Format 3
>>-text-name--+---------------------------------------+--------><
| (1) |
'-+----+--library-name--------file-name-'
+-IN-+
'-OF-'
Notes:
For rules on referencing COPY libraries, see COPY Statement.
The rules for qualifying a name are:
For example:
01 FIELD-A 02 FIELD-B 05 SUB1 07 SUB2 02 FIELD-C 07 SUB1
A hierarchy includes all subordinate entries to the next equal or higher level-number. Therefore, in the above example all entries are in the hierarchy of FIELD-A. All entries from FIELD-B to, but not including, FIELD-C are in the hierarchy of FIELD-B.
In the hierarchy of FIELD-A, SUB1 can be used twice; once as subordinate to FIELD-B and once as subordinate to FIELD-C. In references to SUB-1, it must be qualified as SUB-1 OF FIELD-B or SUB-1 OF FIELD-C. Within FIELD-B or FIELD-C, SUB1 cannot be subordinate to itself.
+-------------------------------IBM Extension--------------------------------+
File-name is optional for the COPY statement, Format 1. If file-name is not specified, the default is QCBLLESRC.
+----------------------------End of IBM Extension----------------------------+
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.