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:
- 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.
- 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.
- Allow the batch job to start to force the CL program to be delayed for
one minute.
- 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.
- Enter the Start Service Job (STRSRVJOB) command as
follows:
STRSRVJOB JOB(qualified-job-name)
- Enter STRDBG and any other debug commands, such as the Add Breakpoint
(ADDBKP) or Add Trace (ADDTRC) command. Proceed
with debugging as usual.