Difference between revisions of "EXIT"

From VSI OpenVMS Wiki
Jump to: navigation, search
(Created page with "'''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 Proce...")
 
 
Line 1: Line 1:
'''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|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 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|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=
 
=Syntax=

Latest revision as of 10:32, 2 December 2019

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.