IBM OS/390 User Manual

Page of 673
Under MVS, the RETURN macro returns control to the calling program and
signals normal termination of the returning program. Control returns after
restoring the address of the calling program
s save area into register 13. The
return is made by executing a branch instruction using the address in register
14. You can write the RETURN macro to restore a designated range of registers,
provide the proper return code in register 15, and flag the save area used by the
returning program.
Sample MVS RETURN - using 
T
′ 
Operand:
L 13,4(13) Get backward chain pointer
 RETURN (3,6),T
(caller
s save area)
+
LM
3,6,12(13)
Restore the registers
+
MVI
12(13),X
FF
Set return indicators
+
BR
14
Return
Sample MVS RETURN - Using 
Return Code
′ 
Operand:
LA
15,0
Set return code zero in R15
L 13,4(13) Get backward chain pointer
 RETURN (14,12),RC=(15)
+
L
14,12(13,0)
Restore register 14
+
LM
0,12,20(13)
Restore registers 0 - 12
+
BR
14
Return
Note:
You should have previously loaded a return code value into register 15.
Figure 29 on page 274 shows an example of MVS coding for initiation and
termination procedures.
Chapter 13. A s s e m b l e r
273