The cause of a GDDM error can be internal or external to the application
program.
- Internal errors
- These errors are intrinsic to the program. They occur,
for example, if incorrect parameters are passed to API
calls or if correct, but unsuitable, parameters produce
unexpected output. The common name for such an error is
a "bug".
- External errors
- These occur, if the environment specified by the end
user's external defaults or the input provided by the end
user does not match the programs needs.
You should aim to eliminate all internal errors from your programs and
GDDM provides a number of debugging aids to help you in this task:
- Error messages
- Error records
- FSQERR, a call that queries the most recent error message and returns
an error record to your program for analysis
- An external default option that enables you to trace the flow of GDDM
calls in your program.
For advice about using these facilities to debug programs, see
"Identifying bugs in your program" in topic 8.3. For a description of
GDDM trace facilities, see the GDDM Diagnosis book.
External errors present a different problem to application programmers.
Handling such errors means anticipating them in your program and taking
action that either corrects the error or at least informs the end user
that there is a problem.
GDDM provides a number of a calls that you can use to handle external
errors:
- Query calls can enable your application to take account of the
environment in which it is running. "Designing device-independent
programs" in topic 19.0, shows how you can use calls such as FSQURY,
FSQDEV, and ESQEUD to help programs avoid errors.
If you include an FSQSYS call in an application, it can determine the
operating system on which it is being run and then invoke the routines
that suit that system.
Using the FSQERR call, application programs can check for GDDM error
messages and records when critical API calls, (such as DSOPEN), or
groups of calls have been issued. This call is most often used for
debugging purposes, but the program can also test the error record
returned and call a suitable error handling routine if necessary.
- The FSEXIT call provides you with a simpler way of performing this
task. With this call, you can tell GDDM to pass control to an exit
routine in your program whenever an error occurs that is above a
specified threshold.
|