Qualification
A name that exists within a hierarchy of names can be made unique 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.)
If there is only one
01 level with a given name, that name can be referenced even if it
is not unique when the QUALIFY(EXTEND)
option is
in effect.
You must specify enough qualification to make the
name unique; however, it is not always 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 MAIN-RECORD
:
EMPLOYEE-NO OF MAIN-RECORD
sufficiently qualifiesEMPLOYEE-NO
.EMPLOYEE-NO OF MAIN-RECORD OF MAIN-FILE
is valid but unnecessary.
Qualification rules
The rules for qualifying a name are:
- A name can be qualified even though it does not need qualification except in a REDEFINES clause, in which case it must not be qualified.
- Each qualifier must be of a higher level than the name it qualifies and must be within the same hierarchy.
- If there is more than one combination of qualifiers that ensures uniqueness, any of those combinations can be used.
- If compiler option
QUALIFY(EXTEND)
is in effect, and if there is only one fully qualified name that matches your combination of qualifiers, that reference will be considered unique, even if the set of qualifiers also matches a partial qualification for a different data item. Fully qualified means every qualifier is specified.