Job trace

Use the job trace tool to trace data in any job to help identify your problem.

Job trace is a problem analysis tool that allows you to look at what any application is doing. Use job trace as a first step in locating a problem with an application. You can turn on job trace in any job to see the call and return flows of that application. Job trace records the raw data and then stores it in a set of database files.

The job trace is performed using a series of CL commands, such as Start Trace (STRTRC), End Trace (ENDTRC), and Print Trace (PRTTRC). Starting a job trace consumes relatively few system resources. However, ending the job trace and printing the job trace require more time and processing resources. If you have a limited amount of interactive capability available on your system, you might want to submit the ENDTRC and PRTTRC commands to batch.

Note that if the application code is created with the OPTIMIZE(40) parameter, the optimization disables call-and-instruction tracing. Although you can specify LICOPT (CallTracingAtHighOpt) to enable job call tracing, the optimization might still disable some calls. Therefore, job trace might not be effective when using the OPTIMIZE(40) parameter.

Use job trace in these situations:

  • You want to debug any job on your system. See the server table information to understand the correlation between the servers and the applications and jobs they represent.
  • You want to troubleshoot your sockets application.
  • You are developing an application for IBM® i and encounter a problem. By tracing the application, you can identify the problem.

To use the CL commands to perform a job trace, you must have *SERVICE special authority defined in your user profile, or be authorized to the service trace function of IBM i through IBM Navigator for i.

Use the following job trace instructions as a guide. The example demonstrates how to use job trace to troubleshoot a sockets application. Sockets adds information to the job trace output when errors are returned on the sockets APIs. You might need to specify different parameters, depending on the type of application you are troubleshooting. Note that communications trace is also useful when troubleshooting sockets applications.