Using the sample program say.c and hello.cob, I tried to get the returning code from c program:
IDENTIFICATION DIVISION.
PROGRAM-ID. hello.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 HELLO1 PIC X(6) VALUE "Hello ".
01 WORLD PIC X(6) VALUE "World!".
IDENTIFICATION DIVISION.
PROGRAM-ID. hello.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 HELLO1 PIC X(6) VALUE "Hello ".
01 WORLD PIC X(6) VALUE "World!".
01 RET PIC S9(9) BINARY VALUE ZEROS.
PROCEDURE DIVISION.
CALL "say" USING HELLO1 WORLD RETURNING RET.
MOVE 1 TO RETURN-CODE.
STOP RUN.
When I compile this program i got this warning
/tmp/cob0zzUoy.c:81: warning: passing arg 1 of `cob_move' makes pointer from integer without a cast
and a runtime error when execute after display message:
Hello World!
Segmentation fault
Can anyone tell me what is wrong?