NET/MASTER Network Control Language (NCL) Reference Manual

ON
Core Statements
106126 Tandem Computers Incorporated 2–37
ON The ON core statement establishes a routine to handle a run-time event. The event can
be a run-time error, a user-specified condition, or a system-defined condition. A
collection of one or more NCL statements that is executed whenever an event occurs is
an “ON block.” An ON block is sometimes referred to as a “condition handler” or
“error handler.”
(For user-specified conditions, or events, see the SIGNAL core statement, described
later in this section.)
When an event occurs, NCL searches for an ON block defined for that event. The
search for an ON block includes all enclosing blocks and outer procedures or function
calls. If no ON block is found for a particular event, NCL regenerates the event as the
general ERROR condition and looks for an ON block defined for that condition. If this
search also fails, NCL terminates the process.
If the ON block takes no explicit action to correct and retry, or to ignore the event, then
NCL terminates the procedure and issues a run-time error code. The FILE_ERROR
condition is an exception. If no ON block is specified for the FILE_ERROR condition,
NCL returns to the statement after the one that caused the error. Table 2-2, presented
later in this subsection, contains a list of the condition names that must be used to
define ON blocks that handle specific events.
The current ON statement always overrides any previously defined ON statement for
the same condition name within the same block. The target statements of ON blocks
can execute in a nested procedure. Procedure or function calls also record the ON
block environment.
ON
condition-name
{ SYSTEM |
statement
}
condition-name
specifies a constant symbol that names the condition to be processed. The name
must be no longer than 32 characters. Condition names are automatically
converted to uppercase letters. You can specify any of the condition names listed
in Table 2-2. User-specified conditions, generated by the SIGNAL core statement,
are named by the user.
SYSTEM
specifies that NCL takes the standard system action for the specified
condition. This has the effect of nullifying any previous ON block defined for
the same condition.
statement
specifies any NCL statement that must process the condition. NCL executes
the statement when the condition is generated. If you want to execute more
than one statement, use a DO group or call a procedure.