Skip to main content

Hi

We execute cobol programs through bash shell

We use C programs to link and call Cobol programs(using cobinit
,cobcall), After executing cobol applications on bash we are getting
return code as zero always. we have displayed the value of the return code just before the stop job in the cobol program and then displayed the return code,its showing correct values like 0001,0002..

This problem occurs after installing latest Cygwin. 
In Cobol program we use STOP RUN RETURN CODE to populate the return codes.

Please suggest


Regards,
Rashi


#COBOLserver

Hi

We execute cobol programs through bash shell

We use C programs to link and call Cobol programs(using cobinit
,cobcall), After executing cobol applications on bash we are getting
return code as zero always. we have displayed the value of the return code just before the stop job in the cobol program and then displayed the return code,its showing correct values like 0001,0002..

This problem occurs after installing latest Cygwin. 
In Cobol program we use STOP RUN RETURN CODE to populate the return codes.

Please suggest


Regards,
Rashi


#COBOLserver

The documentation says:

Passing Return Codes Back to the Calling Program

There are two methods for passing return codes back from the called program to the calling program. You can use the:

RETURN-CODE special register. The called program puts a value in the RETURN-CODE register before passing control back to the calling program with an EXIT PROGRAM or GOBACK statement. The RETURN-CODE register of the calling program is then automatically updated with the called program's return code and this register can be examined accordingly. The RETURN-CODE register is predefined as PIC S9(9) COMP; this can be changed using the RTNCODE-SIZE Compiler directive.

RETURNING or GIVING phrase. The preferred, and more flexible, way of handling return codes is to use the RETURNING or GIVING phrase of the CALL, EXIT PROGRAM, GOBACK, and STOP RUN statements. This phrase enables you to define the format of the return code yourself and so cope with whatever size of return code you require.

Since your STOP RUN statements do not include the RETURNING or GIVING phrases, it seems they are passing back the RETURN-CODE special register, and perhaps the size of the RETURN-CODE special register disagrees with the return code that bash expects under the new Cygwin.

Try compiling the COBOL programs, specifying the compiler directive RTNCODE-SIZE"8" to see if that helps.


Hi

We execute cobol programs through bash shell

We use C programs to link and call Cobol programs(using cobinit
,cobcall), After executing cobol applications on bash we are getting
return code as zero always. we have displayed the value of the return code just before the stop job in the cobol program and then displayed the return code,its showing correct values like 0001,0002..

This problem occurs after installing latest Cygwin. 
In Cobol program we use STOP RUN RETURN CODE to populate the return codes.

Please suggest


Regards,
Rashi


#COBOLserver

The documentation says:

RTNCODE-SIZE"2" : PIC S9(4) COMP: size 2 bytes, aligned on a two-byte boundary.

RTNCODE-SIZE"4" : PIC S9(9) COMP: size 4 bytes, aligned on a four-byte boundary.

RTNCODE-SIZE"8" : PIC S9(18) COMP: size 8 bytes, aligned on an eight-byte boundary.

Since the return code appears as 0001 or 0002 when you display it from within COBOL, perhaps RTNCODE-SIZE"2" is actually the current setting.  In that case, try compiling with RTNCODE-SIZE"4".


Hi

We execute cobol programs through bash shell

We use C programs to link and call Cobol programs(using cobinit
,cobcall), After executing cobol applications on bash we are getting
return code as zero always. we have displayed the value of the return code just before the stop job in the cobol program and then displayed the return code,its showing correct values like 0001,0002..

This problem occurs after installing latest Cygwin. 
In Cobol program we use STOP RUN RETURN CODE to populate the return codes.

Please suggest


Regards,
Rashi


#COBOLserver

Thanks Dan for quick response. i tried the methods suggested .. changing return code size as 4 ,but results are same.

Also i tried GO BACK instead of STOP RUN.. That results into correct return code in C program. And then i returned the value of C .. after doing so i am getting correct value in BASH.

i am not sure why cobol return codes directly to BASH is not working ( using stop run) and while passing control back to calling program and returning it return codes are correct.

Please suggest same way out so that STOP RUN works..


Hi

We execute cobol programs through bash shell

We use C programs to link and call Cobol programs(using cobinit
,cobcall), After executing cobol applications on bash we are getting
return code as zero always. we have displayed the value of the return code just before the stop job in the cobol program and then displayed the return code,its showing correct values like 0001,0002..

This problem occurs after installing latest Cygwin. 
In Cobol program we use STOP RUN RETURN CODE to populate the return codes.

Please suggest


Regards,
Rashi


#COBOLserver

What form are your COBOL programs compiled to (.int, .dll, etc)? Are they linked into the same binary as the C objects, or are they in a separate DLL?

How are you compiling and linking your C programs? What options are you using with GCC?