Compaq AAQ2G1FTK Marine Radio User Manual


 
Interprogram Communication
12.1 Multiple COBOL Program Run Units
Example 12–2 Run Unit with a Main Program and Two Contained Programs
IDENTIFICATION DIVISION.
PROGRAM-ID. MAIN-PROGRAM.
4
.
.
.
CALL SUB1.
.
.
.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. SUB1.
5
.
.
.
CALL SUB2.
EXIT PROGRAM.
IDENTIFICATION DIVISION.
PROGRAM-ID. SUB2.
6
.
.
.
EXIT PROGRAM.
END PROGRAM SUB2.
END PROGRAM SUB1.
END PROGRAM MAIN-PROGRAM.
Special Code for Programs Called ‘‘main’’ (Tru64 UNIX)
On the Tru64 UNIX operating system, if you have a main program called main,
that program preempts a COBOL Run-Time Library (RTL) initialization routine
also called main. This RTL routine is needed to make a CALL data-name
statement (or
cobfunc, cobcall, cobcancel
) work correctly. Your program
main must supply the necessary code by calling the cob_init routine in the RTL.
The cob_init routine specification (in C) is as follows:
void cob_init ( /* init the RTL */
int argc, /* argument count */
char **argv, /* arguments */
char **envp /* environment variable pointers */
)
Note
A Compaq COBOL program called MAIN will only interfere with main if
it was compiled with the
-names lowercase
flag.
12.2 COBOL Program Attributes
Any Compaq COBOL program can have the INITIAL clause in the PROGRAM-ID
paragraph. Data and files in a COBOL program can have the EXTERNAL
clause.
Interprogram Communication 12–3