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-33
Including Text From a COPY Library
Copying Into Debugging Lines
When the source line containing the word COPY is a debug line (has a D or d in the
indicator area), the compiler changes each library line that has a space in its indicator
area to a debug line.
Using Multiple COPY Libraries
There is no limit to the number of COPY libraries the compiler can use in a single
compilation. To specify a nondefault COPY library, use an OF or IN phrase in the
COPY statement; for example:
COPY RECORD1 OF LIBRARY3.
(where LIBRARY3 is on the default volume and subvolume) or:
COPY RECORD1 IN \NODE4.$VOL2.SUBVOL1.LIBRARY2.
(where LIBRARY3 is fully qualified).
Using COPY Libraries Efficiently
You can reduce the time the compiler spends searching for items in COPY libraries by
putting the most frequently used items in the front of their COPY libraries. The reason
is that the first time the compiler encounters a COPY statement, the compiler opens
the default or specified COPY library and reads until it finds the specified item, building
a temporary directory of items as it reads them.
Subsequent COPY statements search the directory for items before searching libraries
for them; therefore, COPY statements that reference items already entered in the
directory compile faster than COPY statements that reference items not yet entered in
the directory. If a specified item is not yet in the directory, the compiler resumes
reading the library after the last item in the directory, continuing to build the directory.
Example 22-7. Copying Into Debugging Lines
Source line:
D COPY DEB-DISP.
Library lines:
?SECTION DEB-DISP
DISPLAY KINGDOM PHYLUM CLASS ORDER
FAMILY GENUS SPECIES.
Compiled as:
D DISPLAY KINGDOM PHYLUM CLASS ORDER
D FAMILY GENUS SPECIES.