COBOL Manual for TNS and TNS/R Programs

Creating and Compiling HP COBOL Source
Programs
HP COBOL Manual for TNS and TNS/R Programs522555-006
22-45
Source Program Listing
Text Before the Word COPY
If the source line on which the COPY statement begins has text before the word
COPY, the compiler tries to combine the original source line with the first line of the
library text. This strategy succeeds only if at least one space separates the first
nonspace character of the library text line from the last nonspace character of the
source line. The combined line retains the line number of the source line that
contains the COPY statement.
Text After the Word COPY
If the source line on which the COPY statement ends has text following the
terminating period, the compiler tries to combine the last line of library text with the
text that follows the COPY statement’s period. This strategy succeeds only if at
least one space separates the last nonspace character of the library line from the
first nonspace character of the remainder of the source line. The combined line
retains the line number of the source line that contains the COPY statement.
ANSI Reference Format
If the current reference format is ANSI, the listed line begins with the identification
field of the appended source line. Example 22-16 shows this behavior.
The compiler does not attempt to combine:
Lines of different reference formats
Debug and nondebugging lines
Library text lines that do not contain a space, D, or d in the indicator area
When the NOSHOWCOPY directive is absent, the compiler lists the line containing a
COPY statement as a comment before listing the line that results from the COPY
statement substitution. The error-reporting mechanism can sometimes report a syntax
error against the copied text and point to the COPY statement in the comment, as in
Example 22-15.
Example 22-15. Diagnostic Reported Against a Copied Line
35 * MOVE COPY SOURCE1. TO X.
** LINE 35 ^
** ERROR 240 ** SYNTAX ERROR DETECTED AT TOKEN: ABLE
35 MOVE ABLE TO X.
** LINE 35 ^
** WARNING 244 ** PARSING RESUMED AT TOKEN: X