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 function check. If it is not, then the exception will be passed to the
caller of the procedure 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 for further information.