NET/MASTER Network Control Language (NCL) Reference Manual

SELECT
Core Statements
2–60 106126 Tandem Computers Incorporated
SELECT The SELECT core statement selects one of several process paths, depending on the
evaluation of a set of expressions.
There are two formats for the SELECT core statement. In both formats, NCL generates
a run-time error if, after evaluating the expressions, none of the expressions is true and
no statement follows the OTHERWISE operand. You can intercept or trap this type of
error in an ON block, but you cannot RETRY the SELECT core statement for this type
of error.
In both formats, multiple WHEN-THEN clauses are permitted. Within the SELECT
core statement, you can use DO groups after the THEN and the OTHERWISE
operands. These DO groups can be labeled (see Section 8, “Compiler Operation,” for
the definition of an NCL label).
In both formats, you are not permitted to label the statements preceded by WHEN or
OTHERWISE.
Format 1
[
label
:] SELECT
WHEN
expression-1
THEN
statement
[
statement
… ]
[ OTHERWISE
statement
[
statement
… ] ]
END [
label
]
When you use multiple WHEN-THEN clauses for Format 1, NCL evaluates each
WHEN expression in turn. If a particular WHEN expression is true, NCL executes the
statement(s) that follow its matching THEN operand, then passes to the END
statement of the SELECT core statement.
If all the WHEN expressions are false, NCL executes the statement(s) that follow the
OTHERWISE operand. You need only provide an OTHERWISE operand if you want
to perform some processing and all the WHEN expressions are false.
label
specifies the name that the compiler checks with the END statement to ensure correct
label-end pairing.
expression-1
specifies true (1) or false (0).
expression-1
must equate to a true or false
condition.
expression-1
can be any valid NCL expression. See Section 10,
“Expressions and Operators,” for a discussion of the evaluation of expressions that
can equate to true or false conditions.