&WAIT Control Statement

Sometimes you want a command list to wait for a specific event or message. With the &WAIT control statement, you define what event causes the command list to resume processing. The command list can wait for any message with a 1- to 10-character message identifier.
Note:
  1. You cannot use &WAIT when operating under the primary POI task (PPT). See Primary POI Task Restrictions for more information using &WAIT under the PPT.
  2. NetView® pipelines, called with the PIPE command, provide both extended function and reduced complexity for the automation of message handling. The PIPE command is an alternative to the &WAIT control statement. For information about NetView pipelines, refer to the IBM Z® NetView Programming: Pipes book.

If you use &WAIT in an automation task command list, be sure to specify a reasonable timeout value. For instructions about coding a time-out event, see The Event=-Label Pair.

If the trapped message satisfies the wait condition, processing of the waiting command procedure resumes. If you do not suppress the message, it continues with the message flow. If you suppress the message, however, the NetView program marks it for deletion. In this case, automation-table processing does not occur and the NetView program does not display or log the message.

&WAIT performs the following actions in a command list:
  • It causes the NetView program to monitor the operator station task (OST) for specific messages and takes action if the message arrives. For example, the command list issues a VTAM® command to activate a resource. When VTAM sends the message saying the resource is active, &WAIT initiates a specific action based on the successful activation of the resource.
  • It initiates a specific action if a message does not arrive in a specified period. For example, for your installation, you might want to display resources if the activation message does not arrive within 5 minutes.
Therefore, you can use &WAIT in the following applications:
  • The command list starts a session with an application program, such as IMS/VS, or another NetView domain. The &WAIT causes the NetView program to monitor the OST for messages indicating the session is started. This satisfies the &WAIT condition. When the &WAIT condition is fulfilled, the command list resumes processing and sends the logon and other information.
  • The command list issues requests for status information from VTAM, and then processes or reformats this information before sending it to the NetView operator.

&WAIT and &PAUSE work differently. With &PAUSE, the command list does not continue until the operator enters the GO command. Operands on the GO command are used in the command list. However, because &WAIT causes the command list to wait for a specific event or events, GO is used to resume the command list only if the event never occurs. When a command list is in a wait state, the NetView program ignores operands on the GO command. RESET, STACK, and UNSTACK work the same way for &WAIT and &PAUSE.