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

Arne Vajhøj arne at vajhoej.dk
Mon Sep 11 16:10:41 EDT 2023


On 9/11/2023 4:00 PM, Brian Schenkenberger wrote:
> 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.

> PROGRAM-ID.     ADVENTURE.
> :
> :
> PROCEDURE DIVISION USING MAGIC-WORDS RETURNING MAGIC-SMOKE TO CALLER.
> -- this is correct syntax up to this point ---------------^

PROCEDURE DIVISION USING MAGIC-WORDS GIVING MAGIC-SMOKE

> :
>      MOVE SS$_XYZZY TO MAGIC-SMOKE.
>          EXIT.
> 
> END PROGRAM ADVENTURE.

Also see the little ADD example I posted.

The args goes in linkage section the result goes in
working-storage section.

Arne





More information about the Info-vax mailing list