IBM AS/400 User Manual

Page of 489
 
 
Exception Handling Overview
 
 Chapter 12. Handling Exceptions
This chapter explains how ILE RPG exception handling works, and how to use:
 
¹
Exception handlers
¹
ILE RPG-specific handlers
¹
ILE condition handlers
 
¹
Cancel handlers
ILE RPG supports the following types of exception handlers:
¹
RPG-specific handlers, for example, the use of an error indicator, an 'E' opera-
tion code extender, or a *PSSR or INFSR error subroutine.
¹
ILE condition handlers, user-written exception handlers that you register at run
time using the ILE condition handler bindable API CEEHDLR.
¹
ILE cancel handler which can be used when a procedure ends abnormally.
Most programs benefit from some sort of planned exception handling because it
can minimize the number of unnecessary abnormal ends (namely, those associated
with function checks). ILE condition handlers also allow you to handle exceptions in
mixed-language applications in a consistent manner.
You can use the RPG exception handlers to handle most situations that might arise
in a RPG application. The minimum level of exception handling which RPG pro-
vides is the use of error indicators on certain operations. To learn how to use them,
read the following sections in this chapter:
¹
“ILE RPG Exception Handling” on page 220
¹
“Specifying Error Indicators or the 'E' Operation Code Extender” on page 227
Additionally, to learn how ILE exception handling works, read:
¹
“Exception Handling Overview” (for general concepts)
¹
“Using RPG-Specific Handlers” on page 226
¹
The sections on error handling in 
ILE Concepts.
For information on exception handling and the RPG cycle, see 
ILE RPG for AS/400
Reference.
Note:  In this book the term 'exception handling' is used to refer to both exception
handling and error handling. However, for consistency with other RPG
terms, the term 'error' is used in the context of 'error indicator' and 'error
subroutine'.
Exception Handling Overview
Exception handling is the process of:
¹
Examining an exception message which has been issued as a result of a run-
time error
¹
Optionally modifying the exception to show that it has been received (that is,
handled)
 Copyright IBM Corp. 1994, 1999 
 
217