NET/MASTER Network Control Language (NCL) Programmer's Guide
Examples Used to Illustrate DEBUG Commands
Debugging an NCL Process
106160 Tandem Computers Incorporated 9–13
Examples Used to
Illustrate DEBUG
Commands
The discussion of individual DEBUG commands throughout the rest of this section
uses two NCL procedures to illustrate the debugging tasks you can perform with each
command. These are the ZEX0902N NCL procedure and the ZEX0903N NCL
procedure.
Purpose of the ZEX0902N
NCL Procedure
The purpose of the ZEX0902N NCL procedure is to analyze a string of characters. The
string is passed to the NCL procedure when executed. The NCL procedure counts the
number of words in the string, calculates the number of characters in each word, and
displays a histogram in the OCS message display showing the frequency of words
having a certain number of characters.
Source Code of the
ZEX0902N NCL Procedure
The source code of the ZEX0902N NCL procedure is shown next. Before reading the
discussion of individual DEBUG commands, you should examine this source code,
especially the comments.
zex0902n: PROCEDURE
/********************************************************************/
/* Analyzes a string: counts the number of words in the string; */
/* works out the number of characters in each word; and displays */
/* a histogram showing the frequency of words having a certain */
/* number of characters. */
/* &SYS.PARMCNT = the number of words in the initial string */
/* Ex: START ZEX0902N THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG */
/********************************************************************/
/* Defines the maximum number of characters to count */
%%DEFINE MAX_CHARS 8
/* Defines the maximum number of words per character count */
%%DEFINE MAX_WORDS 10
/* Check an initial string was entered */
IF &SYS.PARMCNT = 0 THEN DO
SAY 'You must enter at least one word'
EXIT
END /*if*/
/* Pause execution--this is used to show how to debug a currently */
/* executing NCL process */
CMDLINE "GO ID="&SYS.NCLID" _Y"
PAUSE VARS=( &pause )
IF SUBSTR( UPPER( &pause ), 1, 1 ) \== Y THEN
EXIT
/* Set the initial number of characters in a word */
&chars. = 0
/* First count the words by character count */
DO &i = 1 TO &SYS.PARMCNT
&len = MIN( LENGTH( &&i ), MAX_CHARS )
&chars.&len = &chars.&len + 1
END /*do*/
/* Produce the histogram using the internal functions top_title, */
/* left_title, and bar. */
SAY top_title()
DO &i = 1 TO MAX_CHARS
SAY left_title( &i ) ':' bar( &chars.&i )
END /*do*/
SAY top_title()