NET/MASTER Network Control Language (NCL) Reference Manual
An Overview of Expressions
Expressions and Operators
106126 Tandem Computers Incorporated 10–3
The keywords of some verbs restrict how expressions can be used. For example, if you
want to include an expression in a VARS list or a FIELDS list (used with the
VARTABLE verb), you must enclose the expression in parentheses. The examples in
the following table illustrate this:
Example Comment
VARS=(&a,&b,(get_names()),&e) Expression in a VARS list
FIELDS=(data1,(data||&1 &data||&2),adjust) Expression in a FIELDS list
Using Expressions Where a Value is Required in a Statement
Some examples of other NCL statements that include expressions are shown in the
following table:
Statement Type of Statement
&total = &total + 1 Assignment
&userid = &SYS.USERID Assignment
IF &x = &y THEN … IF
DO WHILE &x = &y … DO WHILE
DO UNTIL &x = &y + 5 … DO UNTIL
NCL does not distinguish between arithmetic and Boolean expressions. Certain
statements (for example, the IF core statement) require that the final result of an
expression is a Boolean value (0 or 1), but the expression itself may contain arithmetic
and other operators.
Expression Analysis and
Evaluation
When parsing a statement and whenever an expression is allowed in the syntax,
expression analysis begins. The end of an expression may not be obvious because of
the blank and abuttal concatenation operators. Any one of the following ends an
expression:
The end of a statement
The next keyword that is reserved in the current context
A comma (,) wherever it has meaning in the current context
A closing parenthesis wherever it has meaning in the current context
The following table lists examples that show where an expression ends:
What You Type Expression Ends at
&a = &b + &c; The end of the statement
IF &a &b THEN … The THEN keyword
func(&a + &b,&c * 7) The comma (,)
func(&a + &b,&c * 7) The closing parenthesis
If a comma (,) or closing parenthesis has no meaning in the current context—for
example, if a closing parenthesis is used when there is no preceding opening
parenthesis—NCL returns an error.