Ending program execution

You indicate completion of an assembler language source program by using the RETURN system macro instruction to pass control from the terminating program to the program that initiated it. The initiating program might be the operating system or, if a subprogram issued the RETURN, the program that called the subprogram.

In addition to indicating program completion and restoring register contents, the RETURN macro instruction can also pass a return code—a condition indicator that can be used by the program receiving control.

If the program returns to the operating system, the return code can be compared against the condition stated in the COND= parameter of the JOB or EXEC statement.

If the program returns to another program, the return code is available in general register 15 and can be used as required. Your program should restore register 13 before issuing the RETURN macro instruction.

The RETURN system macro instruction is discussed in detail in the z/OS MVS Programming: Assembler Services Reference IAR-XCT.