HELP ON — VMS 4.6
Defines the default courses of action when a command or program
executed within a command procedure (1) encounters an error
condition or (2) is interrupted by CTRL/Y. The specified actions
are taken only if the command interpreter is enabled for error
checking or CTRL/Y interrupts; these are the default conditions.
You can use the ON command only within a command procedure.
Format:
ON condition THEN [$] command
Additional information available:
Parameters
condition
Specifies either the severity level of an error or a CTRL/Y
interrupt. To specify the severity level of an error, use one of
the following keywords:
WARNING
ERROR
SEVERE_ERROR
You can truncate any of these keywords to one or more characters.
The default error condition is ON ERROR THEN EXIT.
To specify a CTRL/Y interrupt, use the following keyword:
CONTROL_Y
command
Specifies the action to be taken. You can specify any valid command
line after the keyword THEN; you can optionally precede the command
line with a dollar sign ($).
If you specified an error condition as the condition parameter, the
action is taken when errors equal to or greater than the specified
level of error occur.
Examples
1. $ ON SEVERE_ERROR THEN CONTINUE
After this statement is executed in a command procedure, when a
warning or an error occurs the procedure continues normally. When a
severe error occurs, the ON statement instructs the procedure to
continue with the next statement anyway. Once the statement has
been executed as a result of a fatal error condition, the default
action (ON ERROR THEN EXIT) is reinstated.
2. $ ON ERROR THEN GOTO BYPASS
$ RUN A
$ RUN B
.
.
.
$ EXIT
$ BYPASS:
$ RUN C
If either program A or program B returns a status code with a
severity level of error or severe error, control is transferred to
the statement labeled BYPASS and program C is run.
3. $ ON WARNING THEN EXIT
.
.
.
$ SET NOON
$ RUN [SSTEST]LIBRA
$ SET ON
.
.
.
The ON command requests that the procedure exit when any warning,
error, or severe error occurs. Later, the SET NOON command disables
error checking before executing the RUN command. Regardless of any
status code returned by the program LIBRA.EXE, the procedure
continues. The next command, SET ON, reenables error checking and
reestablishes the most recent ON condition.