Coding an &WAIT Control Statement

You can code an &WAIT statement in several ways. This section describes the basic format. Customizing the &WAIT Statement describes ways to customize &WAIT.

When the command list begins processing a &WAIT control statement, NetView® displays the letter W in the upper right corner of the panel if the panel is refreshed because a message is received or the ENTER key is pressed. This W notifies the operator that a command list process is in a wait state. Wait state means that the command list has halted its processing and is waiting for a specific message or group of messages. When the specific message arrives, the control variables and the parameter variables are set to their current values. The &WAIT control statement has the following syntax:

&WAIT

Read syntax diagramSkip visual syntax diagram&WAIT 'command'  event=-label
where:
'command'
Is any command or command list that you can issue from the NetView program. This command is optional. It is usually the command from which the command list is waiting for messages. For example, if you want the command list to wait for a successful session startup, the entire BGNSESS command is coded between single quotation marks. Be sure to code command list continuation characters before the event=-label pairs. The command is run as soon as it is reached in the command list.

You can code one of the NetView timer commands, AT, EVERY, or AFTER, in the &WAIT statement. If the scheduled command is a command list, it cannot run until either the current command list is complete or the STACK command is entered.

event=-label
Is an event=-label pair. You can code as many of these pairs as you want on an &WAIT statement, up to the limit of 255 characters. The event is usually a message for which the command list is waiting. The event can be a trigger that ends the wait state before the message arrives. The &WAIT statement causes the NetView program to scan all messages sent to the operator. If a message matches one of the events coded, the command list goes to the line with the specified label and continues processing from the labeled statement. For more information about the types of events that can satisfy an &WAIT, see The Event=-Label Pair.

When the NetView program receives the message it is waiting for, the message is displayed on the operator terminal, as are all NetView messages. However, in this case, the message type is W unless the message satisfying the &WAIT originated from a command list, in which case the message type remains C. If you do not want the operator to see this message, see Customizing the &WAIT Statement.

The only messages checked are those that are intended for the operator screen. If you code the DSIEX02A exit routine (output to the operator), the &WAIT control statement might not set the message for matching. For example, if the DSIEX02A exit routine deletes the message, the &WAIT control statement does not get the message so a match is not made. Because the operator does not receive the message, neither does the waiting command list. Therefore, wait only for messages that are displayed on the NetView console.

When coding the &WAIT command control statement, it is important to code an event=-label pair for the DSI210I message and the *NN event. The DSI210I message is returned when the command found in the command list is not authorized for this operator, and the *NN event prevents waiting indefinitely for operator intervention. The statements following labels need to notify the operator of the error and exit the command list.

The W that signifies wait state, if present, remains in the upper right corner of the panel while this initial &WAIT command is processed. The W indicates that NetView is still waiting for messages. If the operator enters GO before this command or command list completes processing, the GO is rejected with the DSI016I NOT IN PAUSE OR WAIT STATUS message. When the command or command list is complete, the GO is accepted. RESET ends a command list that is in a wait state. If you enter the STACK command, the W is no longer displayed in the upper right corner of the panel.

You can code several event=-label pairs, but the first message or other condition that matches one of the events stops the command list from waiting for more messages. You can change this if you want to process several messages with one &WAIT statement. See Customizing the &WAIT Statement.