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

Pausing for Operator Input
Interaction With Users and Terminals
106160 Tandem Computers Incorporated 13–5
The FLUSH command terminates execution of the NCL process. You can trap the
run-time error raised by flushing the NCL process by using the ERROR or
FLUSH_ERROR error handler. For more information, see Section 7, “Run-Time Error
Handling.”
Pausing for Operator
Input
You can use the PAUSE verb from an NCL process to suspend the execution of the
NCL process and to display a message in the OCS message display area. The NCL
process is suspended until you either request it to continue or terminate it.
You can use the NonStop NET/MASTER Management Services (MS) GO command to
cause a paused NCL process to continue execution and to pass data to it. You can use
the NonStop NET/MASTER MS FLUSH command to terminate execution of a paused
NCL process.
The PAUSE verb allows you to specify how you want variables to be treated and how
data is to be interpreted, by using the ARGS, VARS, SEGMENT, PARSE, and RANGE
keywords. The meaning of these keywords is discussed in the NonStop NET/MASTER
NCL Reference Manual.
The following example uses the PAUSE verb to pause the execution of an NCL process
and to wait for operator input:
zex1303n: PROCEDURE
/* Procedure to pause for operator input. */
/* It is best to have no other NCL processes */
/* executing when you try this example; */
/* otherwise you will need to enter the NCL */
/* ID to uniquely identify the NCL process. */
SAY "Enter GO YES followed by a sentence, GO NO, or GO"
PAUSE VARS=&string PARSE=NO
SAY "Whole string is: "&string
PARSE VARS=&test PARSE=YES REMSTR=&rest DATA=&string
SAY "Word 1 is: "&test
SAY "Rest is: "&rest
&char = UPPER( SUBSTR( &test, 1, 1 ))
SELECT
WHEN &char = Y THEN SAY "Your sentence is "&rest
WHEN &char = N THEN FLUSH
OTHERWISE CALL zex1303n
END
END zex1303n
In this example, the NCL process uses the SAY core statement to display a message on
the screen. It uses the PAUSE verb to wait for input, reading the input into the
variable &STRING. It then uses the PARSE verb to split the string: the first word,
which must be either YES or NO, is placed into the variable &TEST, and the rest of the
string is placed into the variable &REST. The NCL process uses the SUBSTR built-in
function to extract the first character of &REST and the UPPER built-in function to
convert it to uppercase. It uses the SELECT core statement to determine its course of
action.