RETURN

Use the RETURN statement to return control (and the contents of all output parameters specified by the OUTPUT statement) to the calling state table or script. Any statement following the RETURN statement is not executed.

The RETURN statement can return control to the calling state table with or without a return code, or can be used to abort the script.

If an exception definition script is used to invoke the RETURN statement, it should return the following return codes:

0
The exception condition was not found. In this case, the associated exception handler script is not called.
1
The exception condition was found. This invokes the associated exception handler to clear the exception condition.

If an exception handler script is used to invoke the RETURN statement, it should return the following return codes:

0
The exception handler handled the exception condition.
1
The exception handler failed to handle the exception condition. This causes the script containing the EXCEPTION statement to abort (see ABORT).
2
The exception handler is unsure about how to handle the exception condition. This causes the script containing the EXCEPTION statement to initiate the exception condition again.

Syntax


This picture shows the syntax of the RETURN statement.

Examples

RETURN;
RETURN exception_code;

Procedure

To use the 3270 Script window’s Statements menu to define a RETURN statement, follow this procedure:

  1. From the Welcome window, click on Applications —> 3270 Servers
  2. Selecting the RETURN statement : Click Statements —> Return.

    The system displays the menu of return options.

  3. Defining the return option : Click one of the following return options:
    • Return to return to the calling state table or script normally, without passing a return code.
    • Exception Return to specify a return code value to return to the calling state table or script.
    • Abort to abort the script and return to the calling state table or script immediately.

    The RETURN or ABORT statement is added to the script.