Previous Page | Next Page

Controlling Program Flow

Using the SCL RETURN Statement

The RETURN statement stops the execution of the program section that is currently executing.

RETURN <value>;

The RETURN statement at the end of a reserved program section (FSEINIT ,INIT, MAIN, TERM, and FSETERM) sends control to the next program section in the sequence.

The first RETURN statement after a LINK statement returns control to the statement that immediately follows the LINK statement.

When the RETURN statement is encountered at the end of a window variable section, control returns to the next section in the program execution cycle. That next section may be another window variable section or it may be the MAIN section. When the current program execution cycle finishes, control returns to the application window.

The RETURN statement at the end of a method returns control to the calling program.

The RETURN statement for an ENTRY or METHOD block can return value if the ENTRY or METHOD statement contains RETURN=data-type. The returned value has no effect if control does not immediately return to the calling program.

For an example of the RETURN statement, see the example in Branching to Another Entry (GOTO) in SCL Programs. For more explanation and an additional example, see RETURN.

Previous Page | Next Page | Top of Page