Problem:
In the cobol program the GOBACK statement is followed by a number. When the GOBACK statement is executed the value is not returned.
How can this value be returned and displayed?
Program contains
GOBACK 3.
Resolution:
You must use RETURNING
cob -xav goback2.cbl
./goback2
echo $?
IDENTIFICATION DIVISION.
PROGRAM-ID. GOBACK2.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
FIRST-PARA.
DISPLAY "This program is just to test GOBACK "
"RETURNING 3"
GOBACK RETURNING 3.
Then run unix script or enter command echo $?