RETURN

Format

Read syntax diagramSkip visual syntax diagramlabelRETURN1( reg1, reg2),T,RC=number( reg)
Notes:
  • 1 The following parameters are optional and may be specified in any order. For any parameter not specified, the default value, if applicable, is used.

Purpose

Use the RETURN macro to return control from one program to the program that called it.

The RETURN macro can also restore the contents of certain registers belonging to the program to which control is returning. It can also supply the program with a return code and flag the save area where the values of its registers were saved.

Parameters

(reg1)
(reg1,reg2)
Specifies the single register, (reg1), or the range of registers, (reg1,reg2), whose values are to be restored from the save area.

The RETURN macro uses the same conventions for restoring registers that the SAVE macro uses. They are restored in the following general order: 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12.

To specify a range of registers to be restored, substitute the first register in the range for the reg1 parameter. Then, substitute the last register in the range for the reg2 parameter. Obviously, a subset of the preceding general order is permissible, but remember the general order when specifying a range of registers.

Never specify register 13 as a register whose value is to be restored.

If you omit this parameter, no registers are restored.

T
Indicates that you want the save area, from which the register values are restored, to be flagged.

The flag indicates that the program issuing the RETURN instruction (which save the values) has returned control to the program that called it.

The flag itself is a byte of all ones placed in the high-order byte of word 4 in the save area.

RC
Specifies the return code to be passed to the program to which control is being returned.

The value of this return code has meaning only to the applications involved.

You can write this parameter as decimal digits, as an EQU symbol, or as register (15). If you write it as one or more digits or as a symbol, then the return code is right-justified in register 15 just before control is returned. If you write it as register (15), then the macro assumes that the program returning control has placed the return code in register 15. Register 15 will be left alone during the restoration of the other registers.

If you omit this parameter, the contents of register 15 will be determined by the reg1 or reg1,reg2 parameter.

Usage

  • If registers are to be restored or if the save area is to be flagged, then register 13 must contain the address of the save area.

Examples

GOBACK RETURN (14,7),T,RC=40
The program requests that control be returned to the program that called it. Registers 14, 15, and registers 0 through 7 are to be restored. A flag byte is to be placed in the save area, and a return code of 40 is to be placed in register 15. Note that the return code replaces the value that was just restored to register 15. GOBACK is the label on this instruction.

Return Codes and ABEND Codes

The RETURN macro generates no return codes and no ABEND codes.