COBOL Manual for TNS/E Programs (H06.03+)
Program Compilation
HP COBOL Manual for TNS/E Programs—520347-003
11-6
Compilation Units
Called programs are not required to be in the main program’s 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-3 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.
IDENTIFICATION DIVISION.
PROGRAM-ID. CALLER.
* THE MAIN PROGRAM FOR THIS COMPILATION.
...
DATA DIVISION.
...
WORKING-STORAGE SECTION.
01 WS-PARTS.
03 WS-FIRST-PART PICTURE X(30).
03 WS-SECOND-PART PICTURE X(30).
01 WS-PRODUCER.
03 WS-PRODUCER-NAME PICTURE X(60).
03 WS-PRODUCER-ADDRESS PICTURE X(60).
PROCEDURE DIVISION.
CALL "CPGM1" USING WS-PARTS
CALL "CPGM2" USING WS-PARTS WS-PRODUCER
...
END PROGRAM CALLER.
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).
...
Example 11-2. Compilation Unit (page2of2)










