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

Debugging an NCL Process From Start to Finish
Debugging an NCL Process
9–82 106160 Tandem Computers Incorporated
Another Solution for the
NCL Process
Another way of rewriting the source code that draws the calendar in the ZEX0904N
NCL procedure so that it produces correct output is the following:
/* Draw calendar */
/* Heading lines */
SAY "Calendar for: "SUBSTR( DATECONV( 11, &start, N ), 4 )
SAY "Sun Mon Tue Wed Thu Fri Sat"
/* Construct display line up to starting point of first day */
&line = COPIES( " ", &first - 1 )
/* Get numbers of days in month */
&days = &days.&month
/* Start loop to construct each display line */
DO &day = 1 TO &days
/* Add right justified day to display line and add two */
/* spaces as additional padding */
&line = &line || OVERLAY( &day, "",, 3,, R ) || " "
/* If length of display line is exactly divisible by 7, */
/* then output display line */
IF ( &first % 7 ) = 0 THEN DO
SAY &line
&line=""
END /*if do*/
/* Increment day of week at which month starts */
&first = &first + 1
END /*do*/
/* Display final line, if it exists */
IF &line \== "" THEN
SAY &line
By creating another NCL procedure with this solution, called ZEX0906N, you can
confirm that it works.