COBOL Manual for TNS and TNS/R Programs

Program Compilation
HP COBOL Manual for TNS and TNS/R Programs522555-006
11-7
Compilation Units
Called programs are not required to be in the main programs compilation unit. They
can reside in their own files and be compiled to produce separate object files. Such
object files need not be loadfiles. They can exist solely as resources for binding or
linking (see Object File Creation).
Example 11-4 calls program units that are in a separate file, C-ARCHIVE. When the
main program is compiled, the two called programs are included in the resulting target
file. Figure 11-3 shows the compilation of the program containing this fragment,
assuming that COBJECT is the object file produced by the compilation shown in
Example 11-3.
IDENTIFICATION DIVISION.
PROGRAM-ID. CPGM2.
* CALLED PROGRAM 2.
...
DATA DIVISION.
...
LINKAGE SECTION.
01 LS-SUBASSY.
03 LS-SUBASSY-1 PICTURE X(30).
03 LS-SUBASSY-2 PICTURE X(30).
01 LS-MFGR.
03 LS-MFGR-NAME PICTURE X(60).
03 LS-MFGR-ADDR PICTURE X(60).
...
Figure 11-2. TNS Compilation Unit, Listing File, and Object File
Example 11-3. Compilation Unit (page2of2)
Copy
Library
Listing
File
SYMSERV
COBOL85
BINSERV
CSOURCE
CPGM1
CALLER
CPGM2
COBJECT
CPGM1
CALLER
CPGM2
VST517.vsd