Writing Real Programs in DCL, Second Edition

ERROR HANDLING IS A CRITICAL ASPECT of every software application. It is sheer folly to assume that everything will go as planned, that no unusual or unforeseen events will occur. Error handling is no less important for DCL applications, particularly since they are often interactive and operate in the highly variable OpenVMS environment. It is impossible to predict every variation in the environment when you write the application.
Error handling is a weak point in many DCL applications. Error-handling logic is either missing entirely or suffers from a lack of overall organization. In other words, there is no error-handling scheme to deal with all errors in a consistent and predictable fashion. This chapter presents an overview of the OpenVMS error mechanism and describes how this mechanism is employed by DCL. It then goes on to present an error-handling scheme for DCL applications.
The status code is the means by which an OpenVMS program returns an indication of the success or failure of a requested operation. All programs, be they system services, run-time library routines, utilities, or entire applications, return a status code upon completion. The user or program that requested the operation can determine from the status whether the request succeeded or failed. The status may also indicate the reason for the success or failure.
| Bits | Field | Description |
|---|---|---|
| 0 2 | Severity | Severity of the status code (see Table 8.2). |
| 3 14 | Message number | Identifies a specific status code for the facility. A... |