COBOL Manual for TNS and TNS/R Programs

Source Text Manipulation
HP COBOL Manual for TNS and TNS/R Programs522555-006
10-5
COPY Statement
Compiler Directives and the COPY Statement
A compiler directive line cannot appear between the keyword COPY and the period
separator that terminates the statement, unless it is part of pseudo-text (see
REPLACE Statement).
Compiler Directives in Library Text
Library text can include compiler directives, which the compiler obeys when it
analyzes the copied text.
If a TANDEM or ANSI format directive occurs as a qualifier on the SECTION
directive in the library file, the specified formatting is active only for the copied text.
When the copying is complete, the previous formatting is again active.
If a TANDEM or ANSI format directive occurs within the library text, its effect (which
overrides the effect of any format directive that is a qualifier on the SECTION
directive) persists until the copying is complete.
Debugging Lines and the COPY Statement
If the COPY statement itself begins on a debugging line (a line that has a D or d
in the indicator field), all text that the copy operation introduces into the source
program, except comment and compiler directive lines, appears on debugging
lines.
Because debugging lines and continuation lines are mutually exclusive, the
compiler cannot introduce a continued text-word into the source text when the
preceding rules require it to appear on debugging lines.
Sensitivity to Reference Format
Because the compiler analyzes pseudo-text without the benefit of any contextual
information, you must observe the COBOL reference format rules carefully. In
particular, the compiler does not identify a comma, semicolon, or period character
as a separator unless it is followed by at least one space character.
Similarly, the compiler interprets the character sequence X/9 as one text-word
(presumably a PICTURE character-string) rather than as three text-words;
however, the compiler always considers a left parenthesis, right parenthesis, or
colon character to be a separator unless it appears within a nonnumeric literal.
Another reason to carefully observe the reference format rules is that, when the
compiler is performing replacement editing, it analyzes library text without the
benefit of any contextual information.
Including COPY Statements in a Listing
The SHOWCOPY directive determines whether the COPY statement itself appears
in the listing (see SHARED). If you do not specify NOSHOWCOPY, NOLIST, or
SUPPRESS, the compiler lists the COPY statement as a comment followed by the
copied text.