Scenario: Using watch support with a job trace
Assume that you write a sockets server application that occasionally fails. When the application fails, the TCP3B04 socket API error is sent to the job log. To solve the problem, you need to perform a job trace using watch support.
With watch support, the trace is automatically stopped when the TCP3B04 error is sent to the job log. This allows you to capture only the data that you need to analyze the problem and prevents the trace from running longer than necessary.
To perform the job trace using watch support, follow these steps:
- Start the job trace:
- At the command line, type STRTRC and press F4.
- For the Session ID prompt, specify a meaningful session identifier, such as mytrace.
- For the Jobs parameter, specify these values:
- For the Jobs, Job Name prompt, type the job name, such as SOCKETAPP.
- For the Jobs, User prompt, specify the user ID, such as user.
- For the Jobs, Number prompt, type *ALL.
- For the Watch for message, Message identifier prompt,
type TCP3B04.
- For the Watched message queue, Message queue prompt,
type *JOBLOG. This ensures that the job trace stops running when the TCP3B04 message is sent to the job log.
- For the Watched job parameter, specify these values:
- For the Jobs, Job Name prompt, type SOCKETAPP.
- For the Jobs, User prompt, specify the user ID, such as user.
- For the Jobs, Number prompt, type *ALL.
- Verify that the watch support started:
- At the command line, type WRKWCH and press F4.
- For the Watch prompt, type *TRCCMD. You should see QSCSTTxxxx session listed under Trace type. Note that STT in the middle of the session identifier indicates that the watch session was started by the STRTRC command. xxxx indicates a unique identifier for the watch session.
- Verify that the watch support is running:
- At the command line, type WRKACTJOB SBS(QUSRWRK).
- You should see the watch job QSCSTTxxxx running in the QUSRWRK subsystem.
The job is usually in DEQW status if the watched message has not been sent.
- After the TCP3B04 message is sent to the jobnumber/user/SOCKETAPP job log, you should verify that the trace has ended:
- At the command line, type DSPMSG MSGQ(*SYSOPR).
- You should see the CPI3999 message which indicates that the QSCSTTxxxx watch session associated with STRTRC command was ended because of reason code 02. Reason code 02 indicates that Watch for event criteria met because of message id TCP3B04 found in jobnumber/user/SOCKETAPP.
- You can also verify that the watch session has ended using WRKWCH command as indicated in step 2.
- Format the trace output using the Print Trace (PRTTRC) command to analyze the data you collected.
Parent topic:
Scenarios: Using watch support with traces