QUALIFY
QUALIFY
affects qualification rules and
controls whether to extend qualification rules so that some data items
that cannot be referenced under COBOL Standard rules can be referenced.
- Default
QUALIFY=COMPAT
- COMPAT
- If
QUALIFY=COMPAT
is in effect, the behavior will be the same as in previous COBOL compilers. A reference must be unique even if there is only one data item with exactly that complete set of qualifiers. - EXTEND
- If
QUALIFY=EXTEND
is in effect, qualification rules are extended so that some references that are not unique by COBOL standard rules can be unique. If every level in the containing hierarchy of a group of names is qualified, the set of qualifiers is called a complete set of qualifiers. If there is only one data item with a specific complete set of qualifiers, the reference resolves to that data item, even if the same set of qualifiers could match with another reference as an incomplete set of qualifiers.
Example
01 A.
02 B.
03 C PIC X.
02 C PIC X.
.
.
.
Move space to C of A *> Refers to 02 level C (unique only with QUALIFY(EXTEND))
Move space to C of B of A *> Refers to 03 level C (unique by COBOL standard rules)
Move space to C of B *> Refers to 03 level C (unique by COBOL standard rules)