Syntax: ERRORTO statement-label
Discussion: The ERRORTO statement sets a default exception branch. The statement-label is the label of an exception routine that will be executed if a runtime exception occurs that is not handled by an exception path (i.e., by an EXCP= or EXCPSUB= exception trap).
ERRORTO SYSTEM may be specified to clear the ERRORTO statement currently in effect.
The statement-label is automatically cleared after execution, and unless it is reset by another ERRORTO statement, subsequent un-trapped runtime exceptions will initiate the QENDITOR program.
The ERRORTO statement does not affect the GOSUB stack.
Note: ERRORSUB and ERRORTO are mutually exclusive; only one can be active at a time. The latest one that is executed is the one in effect.
ERRORTO 9999 . OPEN (1) "FILE123" . 9999 IF EXCP=11 THEN RUN "QMONITOR" ERROR
In the above example, the default exception routine is set at statement 9999. Subsequent un-trapped runtime exceptions will cause the program to branch to statement 9999, where the Comet system variable EXCP is interrogated. If EXCP equals 11 (indicating "file not found"), the program will run QMONITOR. Otherwise it will initiate the ERROR termination procedure.