IB Statements/exitall

From CometWiki

< IB Statements
Revision as of 11:26, 21 May 2009 by Badge (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

EXITALL statement

Syntax: EXITALL

Discussion: The EXITALL statement returns control to a top-level calling program.

See the information about subprograms.

All subprograms invoked by an ENTER statement must ultimately terminate with an EXIT, EXITALL, or EXITTO statement to return control to the calling program. The EXIT statement returns control to the previous calling program. The EXITALL statement returns control to the top-level calling program (in the case of multi-level subprograms). The EXITTO statement returns control to a specified subprogram level.

A subprogram may execute overlay programs via the RUN statement, in which case the final overlay must execute an EXIT, EXITALL, or EXITTO statement to return to the calling program.

The EXITALL statement returns control from any subprogram level to the top-level calling program (analogous to the way the POPALL & RETURN statements return program control from a nested subroutine to the main routine).

Example:

 Calling program
 ==============================
  ENTER "SUBPROG1",DIR="DSK"


       Subprogram ("SUBPROG1" on "DSK")
       ================================
       ENTER "SUBPROG2",DIR="DSK"


            Subprogram ("SUBPROG2" on "DSK")
            ================================
            ENTER "SUBPROG3",DIR="DSK"


                 Subprogram ("SUBPROG3" on "DSK")
                 ================================
                 ENTER "SUBPROG4",DIR="DSK"


                      Subprogram ("SUBPROG4" on "DSK")
                      ================================
                      .
                      .
                      .
                      EXITALL


This example shows the top-level program executing a subprogram, and the subprogram executing another program, etc. The final subprogram executes an EXITALL instruction, which returns control to the top-level calling program.

Personal tools