NET/MASTER Network Control Language (NCL) Reference Manual
SELECT
Core Statements
106126 Tandem Computers Incorporated 2–61
statement
specifies any NCL statement or group of statements.
statement
can follow
THEN, OTHERWISE, or both. NCL gives a compilation error if you provide an
OTHERWISE operand without a matching
statement
. The NOP core statement
is acceptable, following THEN or OTHERWISE.
Consideration
See also IF, which provides an alternative to the SELECT statement for conditional-
type processing.
Example
The following example executes specific procedures, depending on the value of &A.
This is an example of Format 1 of SELECT:
LABELSEL:PROCEDURE
/* First form of SELECT */
SELECT
WHEN &A = 1 OR &A = 2 THEN
CALL PROC1
WHEN &A = 3 OR &A = 4 THEN
CALL PROC2
OTHERWISE
CALL PROCX
END
END LABELSEL
Format 2
[
label
:] SELECT
expression-2
[ STRICT ]
WHEN
expression-3
THEN
statement
[
statement
… ]
…
[ OTHERWISE
statement
[
statement
… ] ]
END [
label
]
For Format 2, NCL evaluates SELECT
expression-2
first. NCL then evaluates WHEN
expression-3
and compares it to the evaluation of the SELECT expression. The
default comparison is simple equality (either numeric or character with blank
stripping). Alternatively, you can use a STRICT expression comparison. See the
STRICT operand discussion for a definition of simple equality.
If you use more than one WHEN-THEN clause, and the first WHEN condition fails to
give a true result, the next WHEN expression is evaluated and the process is repeated.
The first WHEN expression that results in equality determines the flow. Processing
then proceeds as in Format 1.
label
specifies the name that the compiler checks with the END statement to ensure
correct label-end pairing.