The WAIT macro informs the system that performance of the active task cannot continue until one or more specific events, each represented by a different event control block (ECB), have occurred. Bit 0 and bit 1 of each ECB must be set to zero before it is used. The caller must be enabled, unlocked, and in primary address space control (ASC) mode.
For more information on how to use the WAIT macro to synchronize tasks, see z/OS MVS Programming: Assembler Services Guide.
The requirements for callers of WAIT are:
Environmental factor | Requirement |
---|---|
Minimum authorization: | Problem state and any PSW key. |
Dispatchable unit mode: | Task |
Cross memory mode: | One of the following:
|
AMODE: | 24- or 31- or 64-bit |
ASC mode: | Primary |
Interrupt status: | Enabled for I/O and external interruptions |
Locks: | No locks held |
Control parameters: | ECB and ECBLIST must be in the home address space. |
None.
When using LINKAGE=SVC (the default), the caller cannot have an EUT FRR established.
Before issuing the WAIT macro, the caller does not have to place any information into any register unless using it in register notation for a particular parameter, or using it as a base register.
Some callers depend on register contents remaining the same before and after issuing a service. If the system changes the contents of registers on which the caller depends, the caller must save them before issuing the service, and restore them after the system returns control.
None.
The WAIT macro is written as follows:
Syntax | Description |
---|---|
name | name: Symbol. Begin name in column 1. |
␢ | One or more blanks must precede WAIT. |
WAIT | |
␢ | One or more blanks must follow WAIT. |
event nmbr, | event nmbr: Symbol, decimal digit, or register (0) or (2) - (12). |
ECB=ecb addr | ecb addr: RX-type address, or register (1) or (2) - (12). |
ECBLIST=ecb list addr | ecb list addr: RX-type address, or register (1) or (2) - (12). |
,LONG=NO | Default: LONG=NO |
,LONG=YES | |
,LINKAGE=SVC | Default: LINKAGE=SVC |
,LINKAGE=SYSTEM | |
,RELATED=value | value: Any valid macro keyword specification. |
The parameters are explained as follows:
The ECB parameter is valid only if the number of events is specified as one or is omitted. The number of ECBs in the list specified by the ECBLIST form must be equal to or greater than the specified number of events.
If you specify ECBLIST, ecb list addr and all ECBs on the list must be in the home address space.
When the caller is not in cross memory mode (the primary, secondary, and home address spaces are the same) and no EUT FRR is established, use LINKAGE=SVC. With this parameter, linkage is through an SVC instruction.
When the caller is in cross memory mode (the primary, secondary, and home address spaces are not the same) or if an EUT FRR is established, use LINKAGE=SYSTEM. With this parameter, linkage is through a PC instruction. Note that the ECB must be in the home address space.
The RELATED parameter is available on macros that provide opposite services (for example, ATTACH/DETACH, GETMAIN/FREEMAIN, and LOAD/DELETE) and on macros that relate to previous occurrences of the same macros (for example, CHAP and ESTAE).
WAIT1 WAIT 1,ECB=ECB,RELATED=(RESUME1,
'WAIT FOR EVENT')
.
.
.
RESUME1 POST ECB,0,RELATED=(WAIT1,
'RESUME WAITER')
You have previously initiated one or more activities to be completed asynchronously to your processing. As each activity was initiated, you set up an ECB in which bits 0 and 1 were set to zero. You now wish to suspend your task via the WAIT macro until a specified number of these activities have been completed.
Completion of each activity must be made known to the system via the POST macro. POST causes an addressed ECB to be marked complete. If completion of the event satisfies the requirements of an outstanding WAIT, the waiting task is marked ready and will be executed when its priority allows.
These hexadecimal codes are described in z/OS MVS System Codes.
None.
WAIT ECB=WAITECB
.
.
WAITECB DC F'0'
WAIT 2,ECBLIST=LISTECBS
.
.
LISTECBS DC A(ECB1)
DC A(ECB2)
DC A(X'80000000'+ECB3)
WAIT 1,ECBLIST=LISTECBS,LONG=YES
.
.
.
LISTECBS DC A(ECB1)
DC A(ECB2)
DC X'80'
DC AL3(ECB3)