Availability Guide for Application Design
Instrumenting an Application for Availability
Availability Guide for Application Design—525637-004
8-3
Checking for Errors
application must go offline, then it should do so as gracefully as possible, leaving the
database in a known, consistent state, and leaving a saveabend file for analysis.
Always Check the Error Return
Your program should check for all possible error return values. Errors can occur
during:
•
Interprocess communication
•
Communications input/output
•
Database input/output
•
Transaction begin and commit
•
System function calls
•
Opening and closing resources
Check your code for all verbs, function calls, procedure calls, and other statements that
perform any of these functions, and provide appropriate error-handling code.
Having established all the verbs, function calls, or procedure calls in your program that
can return errors, for each such statement, refer to the appropriate programmer’s
reference manual or messages manual to establish all the error codes that could be
returned. These error codes typically represent one of the following:
•
A normal or benign condition
For example, a file-open operation returned an error after the user mistyped a file
name.
•
An abnormal condition that you might anticipate
For example, a Pathsend requester gets a server-class-frozen error on sending a
server. For these conditions, you should attempt recovery.
•
An unexpected error condition
For these conditions, you should typically stop the process.
Responding to a Benign or Normal Error Condition
For this type of error, no special error handling is usually required. Normal conditions
will be handled by the functional logic of the application. For example, if your program
expects to receive system messages, it is normal to get file-system error 6 on reading
$RECEIVE, indicating that your program has received a system message; the
functional logic of your program should handle the situation.
Note. The $IMON process must be running on your system in order to create a saveabend
file.
Caution. HP occasionally adds to the list of errors that a given product might generate. Check
the accompanying documentation when you install new revisions of HP software and ensure
that your application treats any new error codes in an appropriate way.