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

Writing an Error Handler
Run-Time Error Handling
7–8 106160 Tandem Computers Incorporated
The following example directs NCL to display a series of messages using
&SYS.ERROR system variables when it detects an error, and to exit the procedure
using the EXIT core statement:
zex0704n: PROCEDURE
/* Specifying more than one action */
ON ERROR DO
SAY "Condition is "&SYS.ERROR.COND
SAY "Code is "&SYS.ERROR.CODE
SAY "Line is "&SYS.ERROR.LINE
SAY "Column is "&SYS.ERROR.COLUMN
SAY "Error text is "&SYS.ERROR.TEXT
SAY "Statement is "&SYS.ERROR.STMT
SAY "Proc/Func is "&SYS.ERROR.PROCNAME
EXIT
END
SAY &1" divided by "&2" is "&1/&2
SAY Normal termination
END zex0704n
The following screen shows the results of attempting to execute the procedure twice:
(13:57) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0704N 16 3
16 divided by 3 is 5.33333333333333
Normal termination
NNM1005 START ZEX0704N PROCESSING COMPLETE. NCLID 002040
START ZEX0704N 16 *
Condition is TYPE_ERROR
Code is 4
Line is 13
Column is 35
Error text is
Statement is 1
Proc/Func is ZEX0704N
NNM1005 START ZEX0704N PROCESSING COMPLETE. NCLID 002041
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
The values entered are 16 and 3 (correctly), and 16 and * (incorrectly). When NCL
detects an error, it displays the values of the specified system variables and terminates
execution of the NCL process.