Start/stop exit routine communications

The start/stop exit routine runs either in a system address space or the address space of the caller of CTRACE DEFINE. When a TRACE CT operator command causes the start/stop exit to run, the routine runs in a system address space. If a CTRACE DEFINE causes the start/stop exit to run, either through a parmlib member specified on CTRACE DEFINE or through a parmlib member with the PRESET option, the routine runs in the caller's address space.

In either case, the routine might have to communicate with another address space to make the trace options effective. The following methods to accomplish this are described in this information:
  • Use commonly addressable storage:
    • Address space common areas
    • SCOPE=ALL data spaces
    • SCOPE=COMMON data spaces.
  • Use a program call (PC) routine
  • Schedule a service request block (SRB).

Using commonly addressable storage: If the application doing the tracing does not have its own address space, then it can maintain its trace options in commonly addressable storage. The start/stop routine can copy the desired options from the CTSS to the application-maintained trace control area in commonly addressable storage.

Applications that do have their own address space can attach a permanent task to process trace requests. When the start/stop exit routine gets control, it could do the following:
  • Obtain common storage to pass the CTSS information. (Consider setting up a permanent area to hold the CTSS information.)
  • Copy the CTSS information into this area.
  • Post the task that processes the trace requests. (The ECB must be in common storage.)
  • Wait for the task to complete.
  • Upon being posted with a return code, send the return code back to component trace in register 15.
The task that processes the trace requests could do the following:
  • Wait for a trace request.
  • When posted, move the trace options to private storage.
  • Parse any application-unique options if not already done in the start/stop exit routine.
  • Process the request to start, stop, or change the trace options.
  • Post the start/stop exit with a return code.
  • Loop back to wait for the next request.
Using a PC routine: The application can implement a space-switching PC to get addressability to the correct address space. In this case, the start/stop exit routine could do the following:
  • Set up a register pointing to the CTSS.
  • Issue a PC to the PC routine responsible for processing trace requests.
  • Upon return, send the PC routine's return code back to component trace.
The PC routine responsible for processing trace requests could do the following:
  • Use access register ASC mode to access the CTSS in the home address space.
  • Parse any application-specific options if not already done in the start/stop exit routine.
  • Process the request to start, stop, or change the trace options.
  • Issue a program transfer (PT) or program return (PR) back to the start/stop exit routine with a return code.

See z/OS MVS Programming: Extended Addressability Guide for further information about PC routines.

Scheduling an SRB: The application can schedule an SRB to get addressability to the correct address space. In this case, the start/stop exit routine could do the following:
  • Obtain extended SQA storage for:
    • An SRB
    • A copy of the CTSS and related control areas
    • An ECB.
  • Initialize and schedule the SRB (SCHEDULE macro) to the application's address space.
  • Wait for the ECB to indicate that the SRB has completed.
  • Upon being posted and receiving a return code, send the return code back to component trace.
The SRB routine could do the following:
  • Parse the application-unique options.
  • Process the request to start, stop, or change the trace options.
  • Post the start/stop routine and provide a return code.

See Using a service request block (SRB) for further information.