Debugging Batch Job in AS400 |
Steps to debug submitted Batch Job
In this blog, we will learn how to debug the batch job using the STRSRVJOB (start service Job) command in AS400.
By holding Job itself
- Submit the Job using the SBMJOB command with HOLD(*YES).
- Start Service Job using command STRSRVJOB to service the batch job.
- Start Debug using command STRDBG to debug the program in the job being serviced.
- Source get appears on the screen and then press key F12 to exit.
- Release the Job.WRKJOB and then option 43 to release the job.
- A message appears on the screen.
- Press key F10 and enter command DSPMODSRC on the command line.
- Press Key F3 then F12 and after that press ENTER.
- Debug started.
- Once you are done with debugging, End Debug using the command ENNDBG.
- End the service job using the command ENDSRVJOB.
SBMJOB CMD(CALL PGM(LIBRARY/PROGRAM) HOLD(*YES)
STRSRVJOB JOB(Job Name/User/Number)
The serviced job has been released from the job queue. Press ENTER to start the job or F10 to enter debug commands for that job.
By holding the Job Queue
- Hold the Job queue by using command HLDJOBQ
- Submit the Job using the SBMJOB command in the same JOBQ which gets held.
- Work with user job using command WRKUSRJOB STATUS(*JOBQ) to get job details.
- Start Service Job using command STRSRVJOB to service the batch job.
- Release the jobq using command RLSJOBQ.
- Start Debug using command STRDBG to debug the program in the job being serviced.
- Source get appears on the screen and then press key F12 to exit.
- A message appears on the screen.
- Press key F10 and enter command DSPMODSRC on the command line.
- Press Key F3 then F12 and after that press ENTER.
- Debug started.
- Once you are done with debugging, End Debug using the command ENNDBG.
- End the service job using the command ENDSRVJOB.
HLDJOBQ JOBQ(QBATCH)
SBMJOB CMD(CALL PGM(LIBRARY/PROGRAM) JOBQ(QBATCH)
STRSRVJOB JOB(Job Name/User/Number)
RLSJOBQ JOBQ(QBATCH)
STRDBG PGM(LIBRARY/PROGRAM) UPDPROD(*YES) OPMSRC(*YES)
The serviced job has been released from the job queue. Press ENTER to start the job or F10 to enter debug commands for that job.