End Trace (ENDTRC)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The End Trace (ENDTRC) command ends a trace session that was started by a STRTRC (Start Trace) command.

Restrictions:

Top

Parameters

Keyword Description Choices Notes
SSNID Session ID Name, *PRV Required, Positional 1
DTAOPT Data option *LIB, *DLT Optional
DTALIB Data library Name, *CURLIB Optional
RPLDTA Replace data *YES, *NO Optional
PRTTRC Print trace data *NO, *YES Optional
Top

Session ID (SSNID)

Specifies a session identifier for the trace to be ended. This name must match the session identifier of a trace that had been previously started and is still active.

This is a required parameter.

*PRV
The trace session most recently started by the same user who is running this ENDTRC command will be ended. For example, if the job running the ENDTRC command is running under user profile BOB, the last trace session started under user profile BOB is ended.
name
Specify the session identifier of the trace to be ended.
Top

Data option (DTAOPT)

Specifies whether the trace data that has been collected is stored into database files or if the trace data is deleted.

*LIB
The trace data will be copied into database files. The PRTTRC parameter on this command or the Print Trace (PRTTRC) command can be used to format and print the data.
*DLT
The trace data will be deleted from the internal buffers where it was collected.
Top

Data library (DTALIB)

Specifies the name of the library in which the trace data will be stored. A set of database files will be created in this library to contain the trace data. The files will be created if they do not already exist.

Note: This parameter is valid only if *LIB is specified for the Data option (DTAOPT) parameter.

*CURLIB
The trace data is stored in files in the current library for the job. If no library is specified as the current library for the job, QGPL is used.
name
Specify the name of the library to contain the trace data files. The library must already exist when the ENDTRC command is run.
Top

Replace data (RPLDTA)

Specifies whether trace data that was collected by a previous trace session with the same session identifier is replaced with new trace data. This is determined by checking if the set of database files where the trace data is to be stored already have file members with the same name as the specified trace session identifier (SSNID parameter).

Note: This parameter is valid only if *LIB is specified for the Data option (DTAOPT) parameter.

*YES
If trace data already exists with the specified session identifier, the old trace data is lost and replaced by the new trace data.
*NO
If trace data already exists for the specified session, an error message is sent to the user.
Top

Print trace data (PRTTRC)

Specifies whether trace data is formatted and printed after it is stored in the trace database files.

Note: This parameter is valid only if *LIB is specified for the Data option (DTAOPT) parameter.

*NO
The PRTTRC (Print Trace) command is not run as part of this command.
*YES
The PRTTRC (Print Trace) command is run after the trace data has been stored in the database files.
Top

Examples

Example 1: End Most Recently Started Trace

ENDTRC   SSNID(*PRV)

This command ends the trace session started most recently by the same user who is running the ENDTRC command. The trace data will be stored in a set of files in the current library of the job, or QGPL if there is no current library for the job.

Example 2: End a Trace and Delete Trace Data

ENDTRC   SSNID(DCG1)  DTAOPT(*DLT)

This command ends the trace session DCG1 and deletes the trace data.

Top

Error messages

*ESCAPE Messages

CPC3923
ENDTRC session ID &1 successfully saved into library &2.
CPC3924
ENDTRC session ID &1 successfully deleted.
CPF39CA
Trace session ID &1 not found.
CPF39CB
Trace session ID &1, in library &2, data exists. Specify RPLDTA(*YES).
CPF98A2
Not authorized to &1 command.
CPF39D3
Unable to start/end the trace.
Top