z/OS MVS Programming: Resource Recovery
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Context services exit routines

z/OS MVS Programming: Resource Recovery
SA23-1395-00

Your resource manager can provide exit routines to be invoked when events occur for its interest in a context. Table 1 lists the context services exit routines.

Table 1. Context Services Exit Routines
Exit Routine

Exit Number in:
Hexadecimal
(Decimal)
Equate Symbol

Event
CONTEXT_SWITCH

2
(2)
CTX_SWITCH_EXIT

A call to the Switch_Context service or the termination of a disassociated context
END_CONTEXT

4
(4)
CTX_END_CONTEXT_EXIT

A context is ending for any reason, including a call to the End_Context service
EOM_CONTEXT

5
(5)
CTX_EOM_CONTEXT_EXIT

A context is ending because the address space associated with it is ending. This exit routine is invoked before the END_CONTEXT exit routine
EXIT_FAILED

1
(1)
CTX_EXIT_FAILED_EXIT

A context services exit routine failed
PVT_CONTEXT_OWNER

3
(3)
CTX_PRIVATE_CONTEXT_
    OWNER

A work unit associated with a private context is ending

These exit routines are optional. A resource manager could, for example, use context services without any exit routine and call the Express_Context_Interest service just to keep data in the context_interest_data area the service provides. If, however, your resource manager does choose to provide any context services exit routines, it must also provide an EXIT_FAILED exit routine.

When a context ends, the exit routines that context services invokes, and the order in which context services invokes the routines, depend on:
  • The type of context (privately-managed context or native context)
  • The reason the context is ending

Figure 1 shows the conditions and the order in which exit routines are invoked.

Figure 1. Order of Invocation for Context Services Exit Routines

For a privately-managed context:

  • When the task associated with the context ends:
    1. PVT_CONTEXT_OWNER
    2. CONTEXT_SWITCH (if the owner tells RRS to disassociate the context from the task)
    3. END_CONTEXT
  • When the address space associated with the context ends:
    1. PVT_CONTEXT_OWNER
    2. CONTEXT_SWITCH (if the owner tells RRS to disassociate the context from the task — see note 1)
    3. EOM_CONTEXT
    4. END_CONTEXT (see note 2)
  • When the context is not associated with a task and its owner ends:
    1. EOM_CONTEXT
    2. CONTEXT_SWITCH
    3. END_CONTEXT (see note 2)
  • When the End_Context service was called to end a context associated with a task:
    1. END_CONTEXT
  • When the End_Context service was called to end a context not associated with a task:
    1. CONTEXT_SWITCH
    2. END_CONTEXT

For a native context:

  • When the task associated with the context ends:
    1. END_CONTEXT
  • When the address space associated with the context ends:
    1. EOM_CONTEXT
    2. END_CONTEXT (see note 2)
  • When the End_Context service was called to end the context:
    1. END_CONTEXT
Note:
  1. If the PVT_CONTEXT_OWNER exit routine tells context services to disassociate the context from the task, context services drives CONTEXT_SWITCH exit routines. If any CONTEXT_SWITCH exit routine disallows the switch, context services continues processing to end the context, but it changes the reason for the context end to CTX_FORCED_END_OF_CONTEXT.
  2. During processing the end of an address space, context services invokes the CONTEXT_SWITCH, EOM_CONTEXT, and PVT_CONTEXT_OWNER exit routines before the RTM resource managers (RESMGRs).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014