COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
• 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.
In Example 6, all data-names except PREFIX are unique.
Example 6 Qualified Names
FD TRANSACTION-FILE
...
01 TRANSACTION-REC.
03 ITEM-NO.
05 PREFIX X(2).
05 CODE X(3).
03 QUANTITY S9(8).
...
01 MASTER-REC.
03 CODE-NO.
05 PREFIX X(2).
05 SUFFIX X(3).
03 DESCRIPTION X(70).
Qualification is necessary to refer to either PREFIX item. For example, any of these sentences would
move the contents of one PREFIX to the other PREFIX:
MOVE PREFIX OF ITEM-NO TO PREFIX OF CODE-NO.
MOVE PREFIX IN ITEM-NO TO PREFIX OF MASTER-REC.
MOVE PREFIX OF TRANSACTION-REC TO PREFIX IN CODE-NO.
It is possible to define a collection of program elements such that even complete qualification fails
to establish uniqueness for some of their names. In this case, your program can never reference
these elements. To avoid this situation, follow these rules:
• Do not define two identical data-names subordinate to a data structure unless their references
can be made unique through qualification by intermediate data structure names.
• Do not define two identical record-names subordinate to any file-name. Independent data
items (level-77 items) and record items that are not files must have unique names if they are
to be referenced.
Character-Strings 69










