NET/MASTER Network Control Language (NCL) Programmer's Guide
Run-Time Errors and Error Messages
Run-Time Error Handling
7–2 106160 Tandem Computers Incorporated
It is impossible to describe how to handle all types of errors because error handling
depends on both the specific error and the purpose of the NCL procedure in which the
error occurs. Accordingly, this section provides you with general guidelines rather
than an analysis of specific situations.
Run-Time Errors and
Error Messages
There are many types of run-time errors. Common run-time errors include the
following:
Using an illegal variable name
Attempting to convert a string with only alphabetic characters to a number
Performing a computation that results in a numeric overflow
Attempting to divide by 0 or a nonnumeric denominator
Executing a RETSUB with no previous GOSUB in the same procedure or function
Coding a RETURN in a top-level procedure in order to send variables back to a
(nonexistent) caller
Failing to find a target label
Omitting a required keyword from a verb
Reading from an empty file or reading beyond the end-of-file (EOF)
If NCL detects a run-time error, it displays an error message that describes the error.
If there is no error handler to trap the error, NCL terminates execution of the NCL
process. The following message indicates that execution has failed due to a run-time
error: NNM1004. Refer to the NonStop NET/MASTER Messages Manual or NonStop
NET/MASTER MS online help for a description of this message.
Message number NNM1004 includes an error code that indicates why execution has
failed. Refer to the NonStop NET/MASTER Messages Manual for a description of all
NCL error codes.
The following example shows an NCL procedure that can raise a run-time error when
you execute it:
zex0701n: PROCEDURE
/* Can raise a run-time error */
SAY &1" divided by "&2" is "&1/&2
END zex0701n
The NCL procedure accepts two parameters, and divides the first by the second.
Whether the NCL procedure generates an error depends on the values of these
parameters.