RETURN — Return control

Description

The RETURN macro restores the control to the calling program and signals normal termination of the called program. The return of control is always made by executing a branch instruction using the address in register 14. Because the RETURN macro uses a BR 14 to pass control, it can be used only when the return is to a program that executes in the same addressing mode. The RETURN macro can restore a designated range of registers, provide a return code in register 15, and flag the save area used by the called program.

If registers are to be restored, or if an indicator is to be placed into the save area, register 13 must contain the address of the save area, which must have the standard format.

Syntax

The RETURN macro is written as follows:

Syntax Description
   
   name name: Symbol. Begin name in column 1.
   
One or more blanks must precede RETURN.
   
RETURN  
   
One or more blanks must follow RETURN.
   

   (reg1)
   (reg1,reg2)

reg1 and reg2: Decimal digits, and in the order 14, 15, 0 through 12.
   
   ,T  
   
   ,RC=ret code ret code: Decimal digit, symbol, or register (15). The maximum value is 4095.
   

Parameters

The parameters are explained as follows:

(reg1)
(reg1,reg2)
Specifies the register or range of registers to be restored from the save area pointed to by the address in register 13. If you omit this parameter, the contents of the registers are not altered. Do not code this parameter when returning control from a program interruption exit routine.
,T
Causes the control program to flag the save area used by the called program. The low-order bit of word 4 of the save area is set to 1 after the registers have been loaded; this designates that a called program has executed a return to its caller. Do not specify this parameter when returning control from an exit routine.
,RC=ret code
Specifies the return code to be passed to the calling program. If a symbol or decimal digit is coded, the return code is placed right-adjusted in register 15 before return is made; if register 15 is coded, the return code has been previously loaded into register 15 and the contents of register 15 are not altered or restored from the save area. (If you omit this parameter, the contents of register 15 are determined by the reg1 and reg2 parameters.)
Note: If register 15 is coded and a return code greater than 4095 (decimal) is passed, the results could be either an invalid return code in the message or invalid RC testing.

Example

Restore registers 14-12, flag the save area, and return with a code of 0.
RETURN  (14,12),T,RC=0