Programming considerations

Consider the following when writing the start/stop exit routine:
  • If you set a non-zero return code, component trace assumes one of the following:
    • The entire TRACE CT command failed. Component trace discards all of the command.
    • The entire CTRACE DEFINE failed. Component trace discards all of the macro.

    A DISPLAY TRACE command will show the previous status.

  • If you use a parmlib member on CTRACE DEFINE to start the trace, and you set a non-zero return code, then the define will fail.
  • If the start/stop exit routine detects an error and does not set a failing return code, this will result in incorrect trace options being displayed through the DISPLAY TRACE operator command.
  • A TRACE CT operator command always results in the start/stop exit routine getting control. However, determining whether the start/stop exit will get control during CTRACE DEFINE is more complex when you are using multiple traces or parmlib members. In general, a change in the status of the trace results in the start/stop exit routine getting control.

    The status of the trace consists of the trace mode, buffer size, and options. When you are using multiple traces, a status of likehead means that the status of a sublevel trace is the same as the status of its head level.

    Table 1 lists possible combinations of mode and parameters and, based on the combinations, tells whether the start/stop routine runs. See Using multiple traces for more detailed information about multiple traces.
    Note:
    1. On CTRACE DEFINE, LIKEHEAD=NO is the default. In the column labeled Parameters on CTRACE Macro, assume LIKEHEAD=NO unless specified.
    2. Parameters in Parmlib Member gives the parameters in a parmlib member only if you specified one on CTRACE DEFINE; otherwise, this column is blank.
    3. PRESET Status means that the parmlib member specified on the TRACE CT command has the PRESET option. If PRESET is not in effect, this column is blank.
    4. Mode of Head Level is relevant only when the trace is likehead. If likehead is not in effect, this column is blank.
    5. The figure does not show CTRACE DEFINE with both the LIKEHEAD=YES and PARM=parm parameters because this combination results in an error.
Table 1. Conditions Determining When Start/Stop Routine Runs
Parameters on CTRACE Macro Parameters in Parmlib Member PRESET Status Mode of Head Level Will Start/Stop Routine Run? Comments
DEFINE...       No  
DEFINE, PARM =parm... ON     Yes  
DEFINE, PARM =parm... OFF     No  
DEFINE, PARM =parm... LIKEHEAD   ON Yes  
DEFINE, PARM =parm... LIKEHEAD   OFF Yes Specification of LIKEHEAD results in the exit getting control, even though the mode of the head level is off.
DEFINE...   ON   Yes  
DEFINE...   OFF   No  
DEFINE...   LIKEHEAD ON Yes  
DEFINE...   LIKEHEAD OFF Yes Specification of LIKEHEAD results in the exit getting control, even though the mode of the head level is off.
DEFINE, LIKEHEAD =YES...     ON Yes  
DEFINE, LIKEHEAD =YES...     OFF No  
DEFINE, LIKEHEAD =YES...   ON   Yes The mode of the head level is not relevant because the preset changed the trace from likehead to on.
DEFINE, LIKEHEAD =YES...   OFF   Yes The mode of the head level is not relevant because the preset changed the trace from LIKEHEAD to off. The change results in the exit getting control.
DEFINE, LIKEHEAD =YES...   LIKEHEAD ON Yes  
DEFINE, LIKEHEAD =YES...   LIKEHEAD OFF No