IBM AS/400 Frozen Dessert Maker User Manual


 
Exception Handling Overview
If there is no *PSSR and a function check occurs, the procedure is removed
from the call stack and the exception is percolated to the caller.
Since an inquiry message is never issued for an error in a subprocedure, you
do not have access to the 'Retry' function available for some I/O errors. If you
expect record-lock errors in a subprocedure, you should code an error indicator
or an 'E' extender and check if the status is related to a record being locked.
Note that the PSDS and INFDS have module scope. Both main procedures and
subprocedures can access them.
TIP
A *PSSR is local to the procedure in which it is coded; therefore, to have a
common error routine, you can code a procedure to handle the error and call
the procedure from each local *PSSR.
Differences between OPM and ILE RPG Exception Handling
For the most part, exception handling behaves the same in OPM RPG and ILE
RPG. The key difference lies in the area of unhandled exceptions.
In OPM, if an exception occurs and there is no RPG-specific handler enabled, then
an inquiry message is issued. In ILE, this will only occur if the exception is a func-
tion check. If it is not, then the exception will be passed to the caller of the proce-
dure or program, and any eligible higher call stack entries are given a chance to
handle the exception. For example, consider the following example:
PGM A calls PGM B, which in turn calls PGM C.
PGM B has an error indicator coded for the call.
PGM C has no error indicator or *PSSR error subroutine coded.
PGM C gets an exception.
In OPM, an inquiry message would be issued for PGM C. In ILE, the exception is
percolated to PGM B, since it is unhandled by PGM C. The error indicator in PGM
B is turned on allowing PGM B to handle the error, and in the process PGM C ends
abnormally. There is no inquiry message.
If PGM C has a *PSSR error subroutine coded, then in both OPM and ILE, the
exception is handled by PGM C and the error subroutine is run.
Note: Inquiry messages issued by ILE RPG will start with the prefix 'RNQ', not
'RPG', as in OPM RPG.
Certain behavioral differences exist for some specific errors. See Appendix A,
“Behavioral Differences Between OPM RPG/400 and ILE RPG for AS/400” on
page 373 for further information.
222 ILE RPG for AS/400 Programmer's Guide