NET/MASTER Network Control Language (NCL) Programmer's Guide
Debugging Guidelines
Debugging an NCL Process
106160 Tandem Computers Incorporated 9–7
Loading an External
Procedure Before
Execution
If you are debugging an NCL process that calls an external NCL procedure, you can
use the DEBUG LOAD command to load the file containing the external procedure
before the NCL process requires it. This allows you to set breakpoints in the external
procedure before it is executed—for example, at the entry to the NCL procedure—and
can help you isolate the bug(s) you are looking for. You are unable to load an NCL
procedure in this way without first using the DEBUG LOAD command.
NCL uses the default search path to attempt to locate the file containing the external
procedure. The default search path is discussed in Section 8, “Executing NCL
Procedures.”
Obtaining Stack Trace
Information
Using the DEBUG TRACE command, you can obtain stack trace information: that is,
information about nesting levels resulting from calling a procedure, function,
subroutine, or error handler. This can help you determine if the procedure, function,
subroutine, or error handler is called correctly. You can also obtain the current values
of the parameters &1 through &n, which can be passed to a procedure or function
when it is called. You are unable to obtain stack trace information without the DEBUG
TRACE command.
Stopping a Debug Session When you have finished debugging an NCL process, you can use the DEBUG STOP
command to stop the debug session. There are two forms of the command: the
DEBUG STOP ID=ncl-id command, which stops the debug session for a specific NCL
process, and the DEBUG STOP ALL command, which stops the debug session for all
NCL processes, including multiple debug sessions.
Debugging Guidelines It is impossible to prescribe how to debug an NCL process, because of the variety of
possible bugs. You may find it convenient, however, to follow the guidelines listed
later. The order of these guidelines is not prescriptive: rather, it represents a
suggested debugging sequence.
These guidelines present a high-level overview of the tasks involved in debugging and
the DEBUG commands you should use for each task. Sample debugging sessions
shown later in this section present debugging tasks in more detail, including screens of
your debugging work in progress.
Before Debugging an NCL
Process
After writing an NCL procedure in Edit Services:
1. Perform a test compilation of the NCL procedure by using the C option in Edit
Services or the NCLCHECK command in OCS. See Section 4, “Initial NCL
Procedure Development,” for more on performing a test compilation.
2. Locate and correct all compilation errors in the NCL procedure by examining the
result of the test compilation.
3. Execute the NCL procedure and examine the output:
If you obtain a run-time error and you are using an error handler that displays
the values of the &SYS.ERROR system variables, examine the values to try to
determine the cause of the error. See Section 7, “Run-Time Error Handling,”
for more on error handling and using &SYS.ERROR system variables.