NET/MASTER Network Control Language (NCL) Programmer's Guide
Conditional Execution
Controlling Execution Flow
5–30 106160 Tandem Computers Incorporated
The following example shows an NCL procedure that uses the first form of the
SELECT statement:
zex0520n: PROCEDURE
/* First form of SELECT */
/* Displays number of days in month */
IF TYPECHK(NUM,&1) = NUM AND,
&1 >= 1 AND,
&1 <= 12,
THEN SELECT
WHEN &1 = 2 THEN SAY "28 or 29 days"
WHEN &1 = 4 OR,
&1 = 6 OR,
&1 = 9 OR,
&1 = 11 THEN SAY 30 days
OTHERWISE SAY 31 days
END
ELSE
SAY "Enter month as a number: 1 through 12"
END zex0520n
This procedure returns the number of days in a month. You specify the month as a
numeric parameter following the START command. The value of the month is
assigned to the parameter variable &1. The procedure uses the IF statement to check
whether the parameter is a number from 1 through 12. (Notice the use of the Boolean
AND operator.) If so, it executes a SELECT statement that uses the value of &1 to
determine and display the number of days in the month. (Notice the use of the
Boolean OR operator.) If not, it displays a message and terminates.
The following screen shows the results of executing the procedure seven times:
(14:21) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0520N
Enter month as a number: 1 through 12
NNM1005 START ZEX0520N PROCESSING COMPLETE. NCLID 014027
START ZEX0520N 1
31 days
NNM1005 START ZEX0520N PROCESSING COMPLETE. NCLID 014028
START ZEX0520N 2
28 or 29 days
NNM1005 START ZEX0520N PROCESSING COMPLETE. NCLID 014029
START ZEX0520N 4
30 days
NNM1005 START ZEX0520N PROCESSING COMPLETE. NCLID 014030
START ZEX0520N 11
30 days
NNM1005 START ZEX0520N PROCESSING COMPLETE. NCLID 014031
START ZEX0520N 0
Enter month as a number: 1 through 12
NNM1005 START ZEX0520N PROCESSING COMPLETE. NCLID 014032
START ZEX0520N ABC
Enter month as a number: 1 through 12
NNM1005 START ZEX0520N PROCESSING COMPLETE. NCLID 014033
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>