EGL Reference Guide for iSeries

exit

The EGL exit statement leaves the specified block, which by default is the block that immediately contains the exit statement.



Syntax diagram for the exit statement

case
Leaves the most recently entered case statement in which the exit statement resides. Continues processing after the case statement.

An error occurs if the exit statement is not inside a case statement that begins in the same function.

if
Leaves the most recently entered if statement in which the exit statement resides. Continues processing after the if statement.

An error occurs if the exit statement is not inside an if statement that begins in the same function.

program
Leaves the program.

The value in the system variable sysVar.returnCode is returned to the operating system in any of the following cases:

If the program ends with a terminating exit statement that includes a return code other than sysVar.returnCode, the specified value is used in place of any value that may be in sysVar.returnCode.

returnCode
A literal integer or an item or constant that resolves to an integer. The return code is made available to the operating system.

For details on return codes, see sysVar.returnCode.

sysVar.returnCode
The system variable that includes the value returned to the operating system.

For details, see sysVar.returnCode.

stack
Returns control to the main function without setting a return value for the current function. A statement of the form exit stack removes all references to the intermediate functions in the run-time stack, which is a list of functions; specifically, the current function plus the series of functions whose running made possible the running of the current function.

If you do not specify a label (as described later), processing continues at the statement after the most recently run function invocation in the main function. If you specify a label, processing continues at the statement that follows the label in the main function. The label may be before or after the most recently run function invocation in the main function.

If you specify an exit statement of the form exit stack in the main function, the next statement is processed, even if you specify a label. For details on how to go to a specified label in the current function, see goTo.

label
A series of characters that are displayed in the main function and outside of any blocks, including these:

When displayed at the location where processing continues, the label is followed by colon. For details on valid characters for the label, see Naming conventions.


Related reference
goTo
Naming conventions
sysVar.returnCode


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]