Example: COBOL program called by a C program
The following example shows how to write COBOL programs that are called by C programs.
The COBOL program tprog1 is called by the C function MyFunD in program MyFun.c (see Example: C programs that are called by and call COBOL). The called COBOL program contains the following source code:
*
IDENTIFICATION DIVISION.
PROGRAM-ID. TPROG1.
*
DATA DIVISION.
LINKAGE SECTION.
*
01 X USAGE COMP-2.
*
PROCEDURE DIVISION USING X.
DISPLAY "TPROG1 got x= " X
GOBACK.