EXIT

From VSI OpenVMS Wiki
Revision as of 10:32, 2 December 2019 by Jane.doe (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

EXIT is a DCL command that terminates processing of a command procedure or subroutine and returns control to the calling command level-either an invoking command procedure or interactive DCL. The EXIT command also terminates an image normally after a user enters Ctrl/Y (executing another image has the same effect). EXIT is executed inside of DCL, i.e. it does not invoke an image.

Syntax

EXIT [status-code]
 

Status Code

Defines a numeric value for the reserved global symbol $STATUS. You can specify the status-code parameter as an integer or an expression equivalent to an integer value. The value can be tested by the next outer command level. The low-order 3 bits of the value determine the value of the global symbol $SEVERITY.

If you specify a status code, DCL interprets the code as a condition code. Note that even numeric values produce warning, error, and fatal error messages, and that odd numeric values produce either no message or a success or informational message.

If you do not specify a status code, the current value of $STATUS is saved. When control returns to the outer command level, $STATUS contains the status of the most recently executed command or program.

Examples

$ EXIT 1
 

The EXIT command in this example exits to the next higher command level, giving $STATUS and $SEVERITY a value of 1.

$ CREATE E.COM
$ IF P1 .EQS. "" THEN INQUIRE P1 "Code"
$ CODE = %X'P1'
$ EXIT CODE
$
$ @E 1C
  %SYSTEM-F-EXQUOTA, exceeded quota
 

When the procedure exits, the value of $STATUS is %X1C, which equates to the EXQUOTA message. Note that you can also use the F$MESSAGE() lexical function to determine the message that corresponds to a status code.