12
Interprogram Communication
COBOL programs can communicate with each other, as well as with non-COBOL
programs. Program-to-program communication is conducted by using one (or
combinations) of the following:
• The CALL statement
• External data
•
cobcall
routine
•
cobcancel
routine
•
cobfunc
routine
12.1 Multiple COBOL Program Run Units
A multiple COBOL program run unit consists of either of the following:
• One main (driver) program and one or more separately compiled programs;
each program may or may not have contained programs
• One main program with one or more contained (nested) programs
Separately compiled programs can be concatenated in one source file, or can be
written as separate source files.
12.1.1 Examples of COBOL Run Units
Example 12–1 shows a run unit with three separately compiled programs, none of
which have contained programs. MAIN-PROGRAM (
1
) calls separate program
SUB1 (
2
), that calls separate program SUB2 (
3
).
Interprogram Communication 12–1