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

Introducing NCL Procedures and Functions
Procedures and Functions
6–4 106160 Tandem Computers Incorporated
If you do pass a parameter to the DATE built-in function, you must pass only one
parameter and it must be a parameter that the built-in function recognizes. The
following example is incorrect because it has too many parameters:
DATE(1,2) /* Incorrect, has too many parameters */
The following example is incorrect because the parameter is not one that the DATE
built-in function recognizes:
DATE(Z) /* Incorrect, not a recognized parameter */
Many built-in functions allow you to omit a parameter in the parameter list. If a
parameter is missing, a default value may be used (depending on the built-in
function). An omitted parameter is indicated by one of the following:
Two adjacent commas in the parameter list, for example:
RANDOM(,,1993) /* Result is 351 */
A trailing comma if the omitted parameter is optional and is the last parameter, for
example:
COMPARE(today,tomorrow,) /* Result is 3 */
Shortening the parameter list by omitting one or more optional trailing
parameters, for example:
INSERT("123","ABC",,,) /* Result is 123ABC */
Built-in functions can distinguish between missing parameters and null strings. A null
parameter is indicated by one of the following:
A null string (""), if the parameter is a string, for example:
POS("needle","",5) /* Result is 0 */
Adjacent commas, if the parameter is a number, for example:
RANDOM(,,1993) /* Result is 351 */
Parameters are discussed in more detail later in this section.
Nesting Built-in Functions
You can include a built-in function call within a built-in function call in any position
where an expression can appear. This is called nesting built-in functions. The
following example nests the LENGTH built-in function inside the SUBSTR built-in
function to extract a substring from a string:
zex0602n: PROCEDURE
/* SUBSTR and LENGTH built-in functions */
&a = "ABC"
&b = "123456"
SAY SUBSTR( &b, LENGTH(&a), 3 )
END zex0602n