Debug batch jobs not started from job queues

You can sometimes debug batch jobs that are started on the system but which are not submitted to a job queue.

These jobs cannot be stopped before they start running but they can usually be debugged. To debug jobs not started from a job queue, do the following:

  1. Rename the program that is called when the job starts. For example, if the job runs program CUST310, you can rename this program to CUST310DBG.
  2. Create a small CL program with the same name as the original program (before the program was renamed). In the small CL program, use the Delay Job (DLYJOB) command to delay for one minute and then use the CALL command to call the renamed program.
  3. Allow the batch job to start to force the CL program to be delayed for one minute.
  4. Use the Work with Active Jobs (WRKACTJOB) command to find the batch job that is running. When the display appears, enter option 5 next to the job to obtain the qualified job name.
  5. Enter the Start Service Job (STRSRVJOB) command as follows:
    STRSRVJOB JOB(qualified-job-name)
  6. Enter STRDBG and any other debug commands, such as the Add Breakpoint (ADDBKP) or Add Trace (ADDTRC) command. Proceed with debugging as usual.
Related information
Add Breakpoint (ADDBKP) command
Add Trace (ADDTRC) command
CL command finder