Using resource managers

MVS™ provides resource managers that are invoked to “clean up” resources associated with a task or an address space. A resource manager is a routine that gets control during normal and abnormal termination of a task or an address space. Task or address space termination is the process of removing a task or address space from the system, releasing the resources from the task or address space, and making the resources available for reuse.

During normal termination, RTM invalidates any existing recovery except for STAI/ESTAI recovery routines. 'End of task' resource managers are called, then the task ends. If an ABEND occurs while an 'end of task' resource manager is running, RTM will call any recovery that was established by the resource manager. If that recovery percolates (or is not allowed to retry), then RTM will give control to eligible STAI/ESTAI exits. These STAI/ESTAI exits are not allowed to retry. The task will then enter abnormal termination at the point where we begin to call 'end of task' resource managers as described above. Since we start over again at the beginning of resource manager processing, it is possible for a resource manager to run twice -- once for normal termination and once for abnormal termination.

Abnormal termination begins after an ABEND occurs and all recovery exits have run and percolated. After this, RTM detaches any remaining subtasks, then calls 'end of task' resource managers for an abnormal termination. These resource managers are protected from cancels, detaches and 'SRB-to-task' percolation ABENDs. If an ABEND occurs while a resource manager is running, any recovery that it established is given control and may retry if the ABEND is able to be retried. If the recovery does not retry, RTM continues by calling the next resource manager. After all resource managers have run, the task ends.

'End of memory' resource managers run in the master address space (ASID 1) and do not have access to local storage in the terminating address space. If an 'end of memory' resource manager abends, any recovery that it has established will receive control and be allowed to retry if the ABEND is able to be retried. If the recovery does not retry, RTM continues by calling the next resource manager. After all resource managers have run, the address space is terminated.

If an 'end of memory' resource manager remains dormant for more than four minutes, the system will consider the resource manager to have 'hung' and issues ABEND 30D after scheduling an SVCDUMP of the hang. The resource manager's recovery is allowed to retry ABEND 30D. For more details, see the description of the ABEND 30D in z/OS MVS System Codes.