Previous Topic: Performing Abend RoutinesNext Topic: Advanced CA IDMS Programming Topics


Establishing and Posting Events

At certain times, you may need to suspend execution of your task (that is, enter a wait state) until some specific event is completed. The most frequent event is I/O. Typically, the wait is automatically handled by DC, which puts the task in a wait state and, upon completion of the I/O, places the task in a ready state.

You can define an event simply by naming the event in a wait request. DC, upon receiving the wait request, places your task in a wait state. The task is returned to a ready state when another task (the task performing the event), upon completion, posts the event by name. One typical use of user-defined events is to synchronize the concurrent execution of different tasks; for example, a terminal task and a concurrent nonterminal task.

Steps to Establish and Post an Event

To place a task in a wait state, waiting for the completion of an event, perform the following steps:

  1. Establish a binary fullword field (PIC S9(8) COMP) that identifies the event control block (ECB) to be posted.
  2. Begin execution of the task that will post the event by issuing an ATTACH or a SET TIMER statement.
  3. Place the issuing task in a wait state by issuing a WAIT statement that names the event to be posted.
  4. Post the event, redispatching the waiting task, by issuing a POST or a SET TIMER POST statement in the secondary program.