NET/MASTER Network Control Language (NCL) Programmer's Guide

Single and Repetitive Execution
Controlling Execution Flow
5–2 106160 Tandem Computers Incorporated
Single and Repetitive
Execution
The core statements that control the single and repetitive execution of a DO group are
listed here in order of discussion:
DO and END
ITERATE
LEAVE
Single Execution With the
DO and END Statements
The DO and END core statements, without counters or Boolean conditions, are used to
delineate a DO group, that is, a sequence of statements bound by the DO and END
core statements that is executed once only. The main purpose of this form of the DO
statement is to allow you to execute multiple statements in an IF or SELECT statement
(discussed later in this section). The syntax of a DO group that is executed once only is
the following:
DO
statement1
statement2
statement3
END
The following example shows an NCL procedure that executes one of two possible DO
groups:
zex0501n: PROCEDURE
/* Executes a DO group */
IF &1 = 1 THEN DO
SAY First statement
SAY Second statement
SAY Third statement
END /*do*/
ELSE DO
SAY Fourth statement
SAY Fifth statement
SAY Sixth statement
END /*do*/
END zex0501n
The first DO group is executed when a value of 1 is passed to the NCL procedure;
otherwise, the second DO group is executed.