Using PROCEDURE DIVISION RETURNING . . .

Use the RETURNING phrase in the PROCEDURE DIVISION header of a program to return information to the calling program.


PROCEDURE DIVISION RETURNING dataname2

When the called program in the example above successfully returns to its caller, the value in dataname2 is stored into the identifier that was specified in the RETURNING phrase of the CALL statement:


CALL . . . RETURNING dataname2

CEEPIPI: The results of specifying PROCEDURE DIVISION RETURNING in programs that are called with the Language Environment® preinitialization service (CEEPIPI) are undefined.