IBM AS/400 Frozen Dessert Maker User Manual


 
handler remains in effect until the call stack entry is removed, or until CEEUTX is
called to disable it. See the
System API Reference
for more information on these
ILE bindable APIs.
Figure 118 shows an example of enabling and coding a cancel handler for a sub-
procedure. (Cancel handlers can also be enabled for main procedures in the same
way.)
*-----------------------------------------------------------------
* Define the prototype for the cancel handler. This procedure is
* a local procedure.
*-----------------------------------------------------------------
D CanHdlr PR
D pMsg *
*-----------------------------------------------------------------
* Define the prototype for a subprocedure to enable the cancel
* handler.
*-----------------------------------------------------------------
D Enabler PR
*-----------------------------------------------------------------
* Define the prototype for a subprocedure to call Enabler
*-----------------------------------------------------------------
D SubProc PR
*-----------------------------------------------------------------
* Main procedure. Call SubProc three times.
*-----------------------------------------------------------------
C CALLP SubProc
C CALLP SubProc
C CALLP SubProc
C SETON LR
Figure 118 (Part 1 of 4). Enabling and Coding a Cancel Handler for a Subprocedure
*-----------------------------------------------------------------
* Procedure SubProc. Call Enabler. Since this call will fail,
* define a local *PSSR subroutine to handle the error.
*-----------------------------------------------------------------
P SubProc B
C CALLP Enabler
*-----------------------------------------------------------------
* The PSSR has a RETURN operation, so the call from the main
* procedure to SubProc will not fail.
*-----------------------------------------------------------------
C *PSSR BEGSR
C 'Subproc PSSR'DSPLY
C RETURN
C ENDSR
P SubProc E
Figure 118 (Part 2 of 4). Enabling and Coding a Cancel Handler for a Subprocedure
Chapter 12. Handling Exceptions 245