HELP EXIT — VMS 5.0
Terminates processing of the current command procedure. If the
command procedure was executed from within another command
procedure, control returns to the calling procedure.
If a command procedure is not being executed, the EXIT command
terminates the current image.
Format:
EXIT [status-code]
Additional information available:
Parameters
status-code Defines a numeric value for the reserved global symbol $STATUS. You can specify the status-code 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 three bits of the longword integer value change the value of the reserved global symbol $SEVERITY. If you specify a status-code, DCL will interpret 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
1. $ ON WARNING THEN EXIT
$ FORTRAN 'P1'
$ LINK 'P1'
$ RUN 'P1'
The EXIT command is used as the target of an ON command; this
statement ensures that the command procedure terminates whenever any
warnings or errors are issued by any command in the procedure.
The procedure exits with the status value of the command or program
that caused the termination.
2. $ IF P1. EQS. "" THEN -
INQUIRE P1 "Enter file-spec (null to exit)"
$ IF P1 .EQS. "" THEN EXIT
$ PRINT 'P1'/AFTER=20:00/COPIES=50/FORMS=6
This command procedure tests whether a parameter was passed to it;
if the parameter was not passed, the procedure prompts for the
required parameter. Then it retests the parameter P1. If a null
string, indicated by a carriage return for a line with no data, is
entered, the procedure exits. Otherwise, it executes the PRINT
command with the current value of P1 as the input parameter.
3. $ RUN MYPROG
^Y
$ EXIT
The RUN command initiates execution of the image MYPROG.EXE. Then
the CTRL/Y interrupts the execution. The EXIT command that follows
calls any exit handlers declared by the image before terminating
MYPROG.EXE.