Previous Topic: Lowercase Data

Next Topic: Set Variables to a Particular Value

Debugging Procedures

During the development of procedures coding errors are bound to occur. The &CONTROL TRACE and &CONTROL TRACELOG statements allow you to request statements to be written to your terminal or the system log after variable substitution and before execution. The &CONTROL statement can occur as frequently as required and can therefore be placed strategically within the procedure.

The TRACELAB and TRACEALL options are available to provide label flow tracing and to include additional detail on the trace records that are logged.

The &CONTROL NOTRACE statement returns to normal processing. You will have imposed a limit to the maximum number of trace messages that can be generated by a procedure. By default this limit is 100 messages and has been imposed to stop excessive tracing consuming system resources.

The NCLTRACE command can be used from an OCS window to dynamically start or stop NCL procedure tracing while an NCL procedure is executing. This lets you debug executing processes without having to stop them, edit the NCL to include &CONTROL statements, and then restart them.

For more information about the NCLTRACE command, see the Online Help. For more information about the &CONTROL verb, see the Network Control Language Reference Guide.

When testing procedures that use full-screen processing, the temporary inclusion of variables in a vacant area in a panel can assist in tracking and development. These can be removed when the procedure has been completed.

The &WRITE statement can also be used to great advantage to display the contents of variables at specific points in processing.

When using &WRITE from procedures operating in full-screen mode, the messages are queued and displayed in one or more full-screen panels when the procedure terminates. Having completed the display of any queued messages, the procedure ends.