Scenario of suspending and resuming an SRB

The best way to describe the activities related to the suspending and resuming of an SRB is through an example. Figure 1 shows the SRB routine SRBRTN that runs in address space AS2. PGM1 in AS1 manages a resource that SRBRTN needs.
Figure 1. Suspending and Resuming an SRB
ieaa8001

When SRBRTN needs the resource, it issues the SUSPEND macro, providing a location where the system can return a suspend token and identifying an exit routine.

The exit routine, which runs under the SRB that represents SRBRTN, receives the suspend token and stores it in the common area. It then queues a request for the resource and returns to the system indicating that the SRB is to remain in a suspended state.

PGM1 receives control when the resource is free. It obtains the suspend token from the common area and issues the RESUME macro, providing the suspend token and specifying PURGE=NO. SRBRTN then resumes control, able to use the resource.

It is important that you understand the order in which the code runs. The circled numbers indicate the order. The SUSPEND macro causes the exit routine to run. The RESUME macro causes the code following the SUSPEND macro to run.