Using the WAIT EVENT command

The WAIT EVENT command is used to synchronize a task with the completion of an event performed by some other CICS or MVS™ task.

The completion of the event is signalled (posted) by the setting of a bit pattern into the event control block (ECB). Both the waiting task and the posting task must have direct addressability to the ECB, hence both tasks must execute in the same target region. The use of a temporary storage queue is one way that the waiting task can pass the address of the ECB to another task.

This synchronization technique is illustrated in Figure 1.
Figure 1. Illustration of inter-transaction affinity created by use of WAIT EXTERNAL command. TRN2 must execute in the same target region as TRN1.
TRN1 executes in AOR1. It stores the address of an ECB in a TS queue for TRN2, then suspends with WAIT EVENT ECADDR (ptr-ref). TRN2 executes in AOR1 then reads the address of the ECB, posts it and returns. TRN1 is then resumed.

If TRN2 shown in Figure 1 executed in a different target region from TRN1, the value of ptr-ref would be invalid, the post operation would have unpredictable results, and the waiting task would never be resumed. For this reason, a dynamic or distributed routing program must ensure that a posting task executes in the same target region as the waiting task to preserve the application design. The same considerations apply to the use of WAIT EXTERNAL and WAITCICS commands for synchronizing tasks.



dfhp3t4.html | Timestamp icon Last updated: Thursday, 27 June 2019