COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
Printed lines: MOVE
ABLE TO X.
If “ABLE” in the library line begins in column 22, you get:
Printed lines: MOVE ABLE
TO X.
• 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 243 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 242.
Example 242 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
Example 243 ANSI Format COPY Expansion
Source Program Lines:
PD0023 A. ANSIFMT
PD0024 COPY MOVE1. ANSIFMT
PD0024 COPY MOVE2. ANSIFMT
PD0026 MOVE COPY SOURCE1. TO X. ANSIFMT
PD0027 MOVE COPY SOURCE2. TO X. ANSIFMT
PD0028 MOVE COPY SOURCE3. TO X. ANSIFMT
PD0029 ADD COPY ADD1. COPY ADD2. COPY ADD3. COPY ADD4. TO ANSR. ANSIFMT
PD0030D DISPLAY COPY SHOW-LIST OF SOMELIB. . ANSIFMT
PD0031 STOP RUN. ANSIFMT
COPY Library Lines:
772 Creating and Compiling HP COBOL Source Programs










