COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

COBJECT is called the target file. It contains the object programs that the compiler produces.
Example 148 Compilation Unit
IDENTIFICATION DIVISION.
PROGRAM-ID. CPGM1.
* CALLED PROGRAM 1.
...
DATA DIVISION.
...
LINKAGE SECTION.
01 LS-NAMES.
03 LS-A-NAME PICTURE X(30).
03 LS-B-NAME PICTURE X(30).
...
END PROGRAM CPGM1.
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).
...
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
(page 524)).
Example 149: Calling Programs That Are in a Separate File 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.
Compiler Input 515