WAIT (Wait for Event) Macro

Issue this macro whenever your program requires that an event is completed before processing by the program continues.

You need the macro, for example, if an I/O operation (started by an EXCP macro) must be completed before processing continues.

With the WAIT macro, a task sets itself into the wait state until the event control block (ECB) specified in the macro is posted. An ECB is posted if its event bit (bit 0 of byte 2) is set to 1.

WAIT processing can wait for an ECB in 24-bit or 31-bit addressing mode physically resident above or below 16 MB. When WAIT is issued in AMODE 24, the ECB address is treated as 24-bit address. When WAIT is issued in AMODE 31, the ECB address is treated as 31-bit address.

The types of ECBs that can be referred to in the macro are any of the following:
  • User defined (by a DC F'0' or as the operand of a macro such as ATTACH).
  • TECB
  • CCB or IORB (24-bit address only).

For a discussion of the use of ECBs, refer to the Using z/VSE Macro Support. For a description of the TECB, CCB, or IORB see the corresponding macros.

ECBs are normally used to synchronize tasks within the same partition. Use the XPCC support when tasks belong to different partitions.

Do not use the macro to wait on any of the ECBs listed below if they are not associated with the task (for instance, elapsed timer interval or an I/O operation not started by the same task).

The ECBs are:
  • Telecommunication ECB
  • TECB
  • CCB or IORB (24-bit address only).
An ECB is posted in either of the following ways:
  • Automatically by the system, if the macro that requests the involved service included a valid ECB specification. For example:
    • The CCB or IORB referred to in an EXCP macro.
    • The ECB referred to in an ATTACH macro.
  • By your program when it issues a POST macro that refers to the ECB.

Do not use the WAIT macro together with logical IOCS request macros such as GET, PUT, or CNTRL.

When a WAIT macro is processed, and the corresponding event control block is not posted, the issuing task is set into the wait state. Control is then passed to the supervisor, which makes the processor available to another task in the same or in another partition.
Note:
  1. When a WAIT macro is processed and the corresponding event bit is on, the task retains control. If an ECB or a TECB is to be used more than once, it is the task 's responsibility to reset the event bit as soon as possible after it is posted.
  2. Telecommunication ECBs must not be waited for because their format does not satisfy a WAIT.

Format

Read syntax diagramSkip visual syntax diagramnameWAITblockname(1)

Requirements for the caller

AMODE:
24 or 31
RMODE:
24 or ANY
ASC Mode:
Primary

Parameters

blockname | (1)
The name of the event control block or the CCB or IORB, specified as a symbol or in register notation. For a CCB or an IORB, this is the name of the control block that is used in the EXCP macro.