Using a separate job to debug another batch job submitted to the
job queue allows you to put the batch job into debug mode and to set breakpoints
and traces before the job starts to process.
Use the following steps to debug batch jobs to be submitted
to a job queue:
- Submit the batch job using the Submit Job (SBMJOB) command
or a program that automatically submits the job with HOLD(*YES).
SBMJOB HOLD(*YES)
- Determine the qualified job name (number/user/name) that is assigned to
the job using the Work with Submitted Jobs (WRKSBMJOB) command
or the Work with Job Queues (WRKJOBQ) command.
The Submit Job (SBMJOB) command also displays the name
in a completion message when the command finishes processing.
The WRKJOBQ
(Work With Job Queue) command displays all the jobs waiting to start
in a particular job queue. You can show the job name from this display by
selecting option 5 for the job.
- Enter the Start Service Job (STRSRVJOB) command from
the display you plan to use to debug the batch job as follows:
STRSRVJOB JOB(qualified-job-name)
- Enter the STRDBG command and provide the names of all programs to be debugged.
No other debug commands can be entered while the job is waiting on the job
queue.
- Use the Release Job Queue (RLSJOBQ) command to release
the job queue. A display appears when the job is ready to start, indicating
that you may begin debugging the job. Press F10 to show the Command Entry
display.
- Use the Command Entry display to enter any debug commands, such as the Add
Breakpoint (ADDBKP) or Add Trace (ADDTRC) commands.
- Press F3 to leave the Command Entry display, and then press Enter to start
the batch job.
- When the job stops at a breakpoint, you see the normal breakpoint display.
When the job finishes, you cannot add breakpoints and traces, or display
or change variables. However, you can display any trace data using the Display
Trace Data (DSPTRCDTA) command.
- If you wish to debug another batch job, first end debugging using the End
Debug (ENDDBG) command and then end servicing the job using the End
Servicing Job (ENDSRVJOB) command.