[Info-vax] COBOL, <gack!> again! Return status.

bill bill.gunshannon at gmail.com
Mon Sep 11 16:11:19 EDT 2023


On 9/11/2023 4:00 PM, Brian Schenkenberger wrote:
> On 2023-09-11 19:45:56 +0000, bill said:
> 
>> On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
>>> How does a COBOL program return a status (ie. R0) to a calling 
>>> program? I found a reference to RETURN-CODE but compiler balks at that.
>>>
>>
>> In Unix ending the program with:
>>
>>      STOP RUN RETURNING {literal-1}
>>                         {identifier-1}
>>
>>
>> will make a return code available to the shell.
>>
>> If you want a status returned to DCL I expect that would do it.
>>
>> bill
>>
>> {I really need to get a VMS system running here again.}
> 
> I need a COBOL sub-program to return a value to its COBOL caller.
> 
> PROGRAM-ID.        MAIN-PROGRAM.
> :
> :
> CALL "ADVENTURE" USING MAGIC-WORDS GIVING MAGIC-SMOKE.
> :
> :
> IF MAGIC-SMOKE = SS$_XYZZY THEN
>      do something and tele-transport out of cave.
> END-IF.
> 
> 
> 
> Sub-PROGRAM
> 
> Then, something like
> 
> PROGRAM-ID.     ADVENTURE.
> :
> :
> PROCEDURE DIVISION USING MAGIC-WORDS RETURNING MAGIC-SMOKE TO CALLER.
> -- this is correct syntax up to this point ---------------^
> :
> :
>      MOVE SS$_XYZZY TO MAGIC-SMOKE.
>          EXIT.
> 
> END PROGRAM ADVENTURE.
> 
> — VAXman
> 

OK, give a couple minutes.  :-)

bill




More information about the Info-vax mailing list