NET/MASTER Network Control Language (NCL) Programmer's Guide
Writing an Error Handler
Run-Time Error Handling
7–4 106160 Tandem Computers Incorporated
Writing an Error
Handler
If you want to trap errors during the execution of an NCL process, you must write an
error handler before executing the NCL procedure. There are three parts to writing an
error handler:
Specifying the error condition to trap
Writing the statement to process the error
Recovering from the error (if possible)
Specifying the Error
Condition to Trap
The ON core statement declares a routine to handle an error condition. The syntax of
the ON core statement that specifies an error condition is the following:
ON
condition-name
statement
condition-name
specifies the error condition to trap. You can specify the general error handler
(ERROR), a specific system-defined error handler, or your own user-defined error
handler.
statement
specifies the statement that processes the error condition.
To direct NCL to execute more than one statement when it detects an error during the
execution of an NCL process, use the DO and END core statements to group multiple
statements. The syntax of an ON statement that uses the DO and END statements is
the following:
ON
condition-name
DO
statement1
statement2
statement3
…
END
statement1
,
statement2
,
statement3
specify the statements that process the error condition.
The General Error Handler—ERROR
The general error handler is called ERROR. This error handler is the default. With a
few exceptions (refer to the NonStop NET/MASTER NCL Reference Manual for more
information), it traps all error conditions unless there is another error handler
available to handle a specific error condition.