NET/MASTER Network Control Language (NCL) Programmer's Guide
Getting Started With NCL Procedures
An NCL Tutorial
106160 Tandem Computers Incorporated 3–19
The HELLO2 NCL
Procedure
Now let us create another NCL procedure called HELLO2, as shown in the following
listing:
hello_world: PROCEDURE
/* Displays "hello, world" on an OCS screen */
/* using the WRITE verb */
&1 = "hello,"
&2 = world
WRITE DATA=&1 &2
END hello_world
Follow the steps described earlier in this section to create, test compile, correct, and
execute HELLO2. When executed, the NCL procedure displays the following message
in the OCS message display area:
hello, world
HELLO2 illustrates the point that there are often many ways to produce the same
result using NCL. HELLO2 introduces the language constructs of verbs, variables,
and comments.
Features of HELLO2 Here are some of the features of the NCL procedure HELLO2.
The Comment Statement—/* … */
HELLO2 has a statement called a comment statement (usually called a comment) after
the label HELLO_WORLD: and the PROCEDURE core statement.
Comments are used to describe what an NCL procedure does at a certain point. Any
characters between the comment delimiters (/* and */) are ignored by the compiler.
Comments can be used anywhere that a blank can be used in an NCL procedure. (The
compiler replaces a comment by a blank during compilation.)
The Variables—&1 and &2
HELLO2 contains variables. A variable is a lexical element containing data that can
change during the execution of an NCL process. All variables in NCL (except input
field variables in panel description files) begin with an ampersand (&).
NCL has five types of variables: simple, complex, stem, compound, and nested. The
variables &1 and &2 are called simple variables; simple variables provide direct access
to data and have only one ampersand.
The Quoted String—“hello,”
“hello,” is a quoted string. It is surrounded by quotes because the last character is a
comma (,). Without quotes, NCL assumes that a comma at the end of a line is a line
continuation character. This is the character you use at the end of a line in a TEDIT
file when you want to continue a single NCL statement to the next line.