Debugging Batch Job in AS400

Debugging Batch Job in AS400
Debugging Batch Job in AS400,How to debug a batch job,STRSRVJOB
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

  1. Submit the Job using the SBMJOB command with HOLD(*YES).
  2. SBMJOB CMD(CALL PGM(LIBRARY/PROGRAM) HOLD(*YES)
  3. Start Service Job using command STRSRVJOB to service the batch job.
  4. STRSRVJOB JOB(Job Name/User/Number)
  5. Start Debug using command STRDBG to debug the program in the job being serviced.
  6. Source get appears on the screen and then press key F12 to exit.
  7. Release the Job.WRKJOB and then option 43 to release the job.
  8. A message appears on the screen.
  9. 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.

  10. Press key F10 and enter command DSPMODSRC on the command line.
  11. Press Key F3 then F12 and after that press ENTER.
  12. Debug started.
  13. Once you are done with debugging, End Debug using the command ENNDBG.
  14. End the service job using the command ENDSRVJOB.

By holding the Job Queue

  1. Hold the Job queue by using command HLDJOBQ
  2. HLDJOBQ JOBQ(QBATCH)
  3. Submit the Job using the SBMJOB command in the same JOBQ which gets held.
  4. SBMJOB CMD(CALL PGM(LIBRARY/PROGRAM) JOBQ(QBATCH)
  5. Work with user job using command WRKUSRJOB STATUS(*JOBQ) to get job details.
  6. Start Service Job using command STRSRVJOB to service the batch job.
  7. STRSRVJOB JOB(Job Name/User/Number)
  8. Release the jobq using command RLSJOBQ.
  9. RLSJOBQ JOBQ(QBATCH)
  10. Start Debug using command STRDBG to debug the program in the job being serviced.
  11. STRDBG PGM(LIBRARY/PROGRAM) UPDPROD(*YES) OPMSRC(*YES)
  12. Source get appears on the screen and then press key F12 to exit.
  13. A message appears on the screen.
  14. 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.

  15. Press key F10 and enter command DSPMODSRC on the command line.
  16. Press Key F3 then F12 and after that press ENTER.
  17. Debug started.
  18. Once you are done with debugging, End Debug using the command ENNDBG.
  19. End the service job using the command ENDSRVJOB.

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain