OpenVMS DCL EXITSTATUS: Non-Search Path Logical Names
Often, user questions bring into focus interesting ways to use standard OpenVMS facilities. In a thread entitled how to DCL custom exit? on Hewlett Packard's ITRC OpenVMS Forum, Claus Olesen inquired, among other things how one could EXIT a DCL procedure using the name of a standard OpenVMS status code, rather than an actual numeric value.
This question provides for an opportunity to use several OpenVMS features in concert to address a problem that is often, at best, an annoyance. Indeed, OpenVMS has an extensive repetoire of such codes (857 as of OpenVMS Alpha Version 7.3-2). While developers and maintainers often recognize commonly used codes, remembering the numeric values for less-commonly used codes is an inconvenience.
$ EXITSTATUS_VALUE = "SS$_NOSUCHFILE"|
%SYSTEM-W-NOSUCHFILE, no such file
$ SHOW SYMBOL $STATUS
$STATUS == "%X00000910"
The cost of this is negligible, a handful of bytes of pageable pool. No additional overhead is added to normal logical name lookups, as the logical name table defined for this purpose is not included in the normal logical name lookups done by either RMS or by the $TRNLNM system service.
This implementation consists of two command procedures: