COBOL Manual for TNS and TNS/R Programs

Source Program Organization and Format
HP COBOL Manual for TNS and TNS/R Programs522555-006
2-9
COPY Libraries
COPY Libraries
Any line in a source program can contain a COPY statement, which tells the COBOL
compiler to insert source text from a specified disk file, called a COPY library.
A COPY library is an EDIT or OSS ASCII file divided into one or more sections that
begin with a SECTION directive. In the COPY library, you can specify the reference
format of the line or lines to be copied.
You can specify the name of a COPY library in the source program or in a command to
compile the program:
The COPY statement itself can include the phrase IN library-name (see COPY
Statement).
The command that initiates the compilation can specify a library-name for the
compiler to use whenever a COPY statement does not include a library-name
(see Starting a Compilation).
If you do not specify a library-name in the compile command or in the COPY
statement, the compiler uses the name COPYLIB.
If you do not fully qualify library-name in the compile command or in the COPY
statement, the compiler assumes the library file is on the current default volume or
subvolume or both.
For details on the COPY statement and COPY libraries, see COPY Statement.
Nested Source Programs
Source programs can be nested (that is, a source program can contain other source
programs). One program can contain another program directly or indirectly. When a
program directly or indirectly contains other programs, each program can use the same
user-defined names for different objects.
Topics:
Directly Contained Programs and Indirectly Contained Programs
Scope of User-Defined Names