COBOL Manual for TNS/E Programs (H06.03+)

Language Elements
HP COBOL Manual for TNS/E Programs520347-003
3-13
COBOL Words
These rules apply to qualification of names:
Each qualifier must be at a higher level than the previous one and stay within the
same structure of the name it qualifies.
The same name cannot occur at different levels in a structure; otherwise, the name
could qualify itself.
A data-name used as a qualifier cannot be subscripted; all subscripts that apply to
a qualified data-name appear after all qualifiers.
A name can be qualified even though it does not need qualification. If there is more
than one combination of qualifiers that make a name unique, then any one of them
will do, including complete qualification (naming all qualifiers). HP COBOL permits
a name to be qualified completely, with a name from every level of its structure.
If a data-name or a condition-name is assigned to more than one element in a
source program, the data-name or condition-name must be qualified each time it is
referred to in the Procedure, Environment, and Data divisions (except in the
REDEFINES clause where, by context, qualification is unnecessary). The name of
a data-item can be used as the lowest level qualifier for any of its associated
condition-names.
If a word defined as a status condition-name is assigned to more than one element
in a source program, the condition-name must be qualified by the mnemonic-name
of its external switch each time it is mentioned in the Procedure Division. The
qualification of status condition-names is an HP COBOL extension.
A word can be defined as a paragraph-name more than once in a source program.
If more than one paragraph in the same section of a source program has the same
name, no statement anywhere in the program can refer to any of those paragraphs
by name.
If two or more sections of a source program each contains a paragraph with the
same paragraph-name, unqualified references to that paragraph-name are
acceptable only within such sections—all other references must be qualified. For
example, suppose sections S1 and S2 contain paragraphs named P. All references
to P in other sections must be qualified as P OF S1 or P OF S2. Without such
qualification, they cause the compiler to report an ambiguous reference.
Unqualified references made within S1 to P are assumed to refer to P OF S1, and
unqualified references made within S2 to P are assumed to refer to P OF S2.
Statements in S1 can refer to P OF S2 and statements in S2 can refer to P OF S1.
The word SECTION is not part of a section-name when used to qualify a
paragraph-name.
If a text-name is not a member of the default COPY library, it must be qualified by
its library-name each time a COPY statement mentions it.
If more than one file description entry in a program contains a LINAGE clause, the
special register LINAGE-COUNTER must be qualified by its file-name each time
the Procedure Division mentions it.