NET/MASTER Network Control Language (NCL) Programmer's Guide
Debugging an NCL Process From Start to Finish
Debugging an NCL Process
106160 Tandem Computers Incorporated 9–61
 IF DATECONV( 11, &year"/02/28", 11, 1 ) == &year"/02/29" THEN
 &days.02 = 29
 /* Table to get numeric value of first day of week */
 &start = &year"/"&month"/01"
 SELECT DATECONV( 11, &start, W )
 WHEN Sunday THEN &first = 1
 WHEN Monday THEN &first = 2
 WHEN Tuesday THEN &first = 3
 WHEN Wednesday THEN &first = 4
 WHEN Thursday THEN &first = 5
 WHEN Friday THEN &first = 6
 WHEN Saturday THEN &first = 7
 END
 /* 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 ) || " "
 /* Calculate length of display line */
 &linelength = &days + &first - 1
 /* If length of display line is exactly divisible by 7, */
 /* then output display line */
 IF ( &linelength % 7 ) = 0 THEN DO
 SAY &line
 &line=""
 &linelength=""
 END /*if do*/
 END /*do*/
 /* Display final line, if it exists */
 IF &line \== "" THEN
 SAY &line
END zex0904n










