RETURN


The RETURN statement transfers execution to the statement following the most recent GOSUB statement.

    ••••• RETURN   ••• •••••••••••••••••••••• •••
    (1)            (2) (3)                    (4)

(1) T/F execution conditions

(2) Optional application ID

(3) Optional logic field name, logic PDF, or constant

(4) Optional occurrence (constant/index)

Restores True/False Status Indicators

When you invoke a subroutine using the keyword GOSUB, APPX temporarily stores the true/false status indicators and then clears them so that all five indicators are available for use within the subroutine. When RETURN transfers control back to the statement following the GOSUB, the system restores the indicators to the values that existed at the time the GOSUB was invoked. In addition, when implemented, GOSUB will set the next status indicator to the value indicated by the logic field or constant in the RETURN statement, if any.

Execution Errors

If a RETURN is encountered with no previous GOSUB, a non-recoverable error occurs at runtime.

Related Statements

GOSUB

Example

In this example, the same routine is used to post to both the adjustment account and the receivable account. The actual code is copied into the event point from a subroutine process.

          *        post adjustment
          GOSUB    :POST MTDPOST RECORD
          *        post receivable
          COMPUTE  TAR MTDPOST AMOUNT             *      -1
          SET      TAR MTDPOST ACOUNT             =  TAR ADJUST2 RECEIV ACCOUNT
          GOSUB    :POST MTDPOST RECORD
          *
          END
          *
          LABEL    :POST MTDPOST RECORD
          COPY     TAR POST MTDPOST RECORD

          RETURN