NET/MASTER Network Control Language (NCL) Programmer's Guide

Writing an Error Handler
Run-Time Error Handling
106160 Tandem Computers Incorporated 7–7
Specifying a Single Action After an Error
To direct NCL to perform a single action, use a single statement following the
keyword that specifies the error condition. The following example directs NCL to
execute the FLUSH core statement when it detects an error:
zex0703n: PROCEDURE
/* Specifying a single action */
ON ERROR FLUSH
SAY &1" divided by "&2" is "&1/&2
SAY Normal termination
END zex0703n
This explicitly terminates execution of the NCL process.
The following screen shows the results of attempting to execute the procedure twice:
(13:54) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0703N 10 2
10 divided by 2 is 5
Normal termination
NNM1005 START ZEX0703N PROCESSING COMPLETE. NCLID 002038
START ZEX0703N 10 0
NNM1005 START ZEX0703N PROCESSING COMPLETE. NCLID 002039
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
The values entered are 10 and 2 (correctly), and 10 and 0 (incorrectly). When NCL
detects an error, it terminates execution of the NCL process.
Specifying More Than One Action After an Error
Instructing NCL to flush an NCL process when it detects an error is usually not very
helpful. Usually, you want to know why an NCL process terminates execution. For
this reason, NCL provides many system variables to help you to obtain information
about the error that has occurred. System variables that return error information begin
with &SYS.ERROR.
It is useful to write your error handler to display the values of these system variables.
You can use the DO and END core statements to specify multiple SAY statements after
the ON core statement.