COBOL Manual for TNS and TNS/R Programs
Program Compilation
HP COBOL Manual for TNS and TNS/R Programs—522555-006
11-6
Compilation Units
If there are compilation errors in some, but not all, programs in a compilation unit, the
COBOL85 compiler produces object programs for the programs in which there were no
errors, but the NMCOBOL compiler produces no object file.
Example 11-3 shows a compilation unit in which a main program and two called
programs are included in the input file, contained in file CSOURCE. The command to
compile the compilation unit in Example 11-3 with the COBOL85 compiler is:
COBOL85 /IN CSOURCE/ COBJECT
The command to compile the compilation unit in Example 11-3 with the NMCOBOL
compiler is:
NMCOBOL /IN CSOURCE/ COBJECT
COBJECT is called the target file. It contains the object programs that the compiler
produces. Figure 11-2 illustrates the case for the COBOL85 compiler when no source
file in CSOURCE has compilation errors.
Example 11-3. Compilation Unit (page1of2)
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.