12.6 Calling Compaq COBOL Programs from Other Languages
Example 12–9 COBOL Called Program "CALLEDFROMC"
IDENTIFICATION DIVISION.
PROGRAM-ID. CALLEDFROMC.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 TEST-RESET PIC X(10) VALUE "OFF".
01 RETVAL PIC 9(5) COMP VALUE 357.
LINKAGE SECTION.
01 ARG1 PIC X(10).
01 ARG2 PIC 9(4).
01 ARG3 PIC 9(5) COMP.
PROCEDURE DIVISION USING ARG1 ARG2 ARG3 GIVING RETVAL.
P0.
DISPLAY "In CALLEDFROMC".
DISPLAY "test-reset is: " TEST-RESET
MOVE "on" TO TEST-RESET.
DISPLAY "arg1=" ARG1.
DISPLAY "arg1=" ARG1 ", arg2=" ARG2 ", arg3=" ARG3 WITH CONVERSION.
END PROGRAM CALLEDFROMC.
Values Returned by cobcall and cobfunc
The RTL calls
cobcall
the GIVING clause of the COBOL program whose value is a longword integer
(for example, PIC S9(9) COMP). The results of returning other values from the
program called by
cobcall
Consider this example of the use of
that uses
,
cobcall
cobfunc
program. Following is progc.c, the C program that calls the COBOL program:
Interprogram Communication
and
can return a signed integer value from
cobfunc
or
are undefined.
cobfunc
/
cobcall
cobfunc
, and
to call or cancel another COBOL
cobcancel
/
in a C program
cobcancel
Interprogram Communication 12–21
Need help?
Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?
Questions and answers