Purging an SRB (PURGEDQ macro)

Because an SRB routine is dispatched after the program actually issues either the IEAMSCHD or the SCHEDULE macro, the conditions that existed in the system at the time the macro was issued might have changed by the time the SRB routine begins to run. If, in this time interval, the environment that the SRB routine needs to run successfully has been changed, the results are unpredictable.

An example of a changed environment is when a task or address space terminates, leaving outstanding requests for the task or address space. The system issues PURGEDQs at task and address space termination.

Note: If you used IEAMSCHD, the system filled in the fields of IHASRB. If you used SCHEDULE, the caller filled in the fields of IHASRB.
  • For task termination, the system purges any SRBs associated with the task (SRBPTCB) and its address space (SRBPASID).
  • For address space termination, the system purges any SRBs scheduled to the address space (SRBASCB, with matching SRBPASID.)
If there are any other conditions for which your SRBs should be purged, issue the PURGEDQ macro. A program, such as an ESTAE routine or a resource manager, might use the PURGEDQ macro to:
  • Dequeue SRBs that are scheduled, but not yet dispatched
  • Allow processing for previously scheduled SRBs to complete
  • Purge each dequeued SRB.
  • Purge a preemptable SRB at any point in time.
  • Purge a non-preemptable SRB (that voluntarily gave up control by doing a Pause or a SUSPEND with Token) prior to being released or resumed.