NET/MASTER Network Control Language (NCL) Programmer's Guide
Conditional Execution
Controlling Execution Flow
106160 Tandem Computers Incorporated 5–29
The SELECT and END
Statements
The SELECT core statement tests an expression. It allows NCL to make a multiway
decision based on the outcome of the test. The options are introduced by the WHEN
and OTHERWISE keywords. The END statement closes the block of statements
introduced by the SELECT keyword.
The SELECT core statement has two forms. These are called the first and second forms
of the SELECT statement.
Hint To improve the performance of an NCL process, organize options in a SELECT statement from the most
likely case to the least likely case.
The First Form of the SELECT Statement
The syntax of the first form of the SELECT core statement is the following:
SELECT
WHEN
expression
THEN
statement
…
OTHERWISE
statement(s)
END
The first form of the SELECT core statement evaluates each expression following the
WHEN keyword in turn. The expression following the WHEN keyword must
evaluate to either 1 (TRUE) or 0 (FALSE). NCL executes the statement introduced by
the first expression that evaluates to TRUE if it finds one. After execution, control
passes to the END keyword, which closes the block of statements introduced by the
SELECT keyword.
The OTHERWISE keyword is optional. If NCL does not find an expression that
evaluates to TRUE, NCL executes the statement(s) introduced by the OTHERWISE
keyword if the OTHERWISE keyword is present. If the OTHERWISE keyword is not
present, NCL raises an error. You can use the NOP core statement to allow the
OTHERWISE keyword to explicitly specify no action.