Compaq AAQ2G1FTK Marine Radio User Manual


 
Interprogram Communication
12.6 Calling Compaq COBOL Programs from Other Languages
Example 129 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
and
cobfunc
can return a signed integer value from
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
or
cobfunc
are undefined.
Consider this example of the use of
cobcall
/
cobfunc
/
cobcancel
in a C program
that uses
cobcall
,
cobfunc
, and
cobcancel
to call or cancel another COBOL
program. Following is progc.c, the C program that calls the COBOL program:
Interprogram Communication 1221