I am asked this question a couple of times recently; how do I debug a program that is processed in batch?

In order to make this work ensure the program has been compiled with debug view of *SOURCE
CRTBNDRPG PGM(MYLIB/MYPROG) SRCFILE(MYLIB/QRPGLESRC) DBGVIEW(*SOURCE)

Verify your library list is set up correctly before submitting the job.

  1. Identify the job queue to where the program is being submitted. In some ERP shops there could be multiple job queue’s depending on the type of job. For example, in an INFOR XA shop, Infor uses QBATCH1 through QBATCH6

  2. Place the job queue on hold. In our example, the job is submitted to MYJOBQ
    At a command line type:
    HLDJOBQ MYJOBQ

  3. Submit the job that you need to debug.

  4. Locate the job and note the job name, user id and job number.

  5. Start service job.
    At a command line type:
    STRSRVJOB press F4
    Input the job name, user id and job number from step number 4 above

  6. Start debug on the program. It is recommended that DSPMODSRC (display mod source) parameter is set to *NO. In our example, we will be debugging program MYPROG
    At a command line type:
    STRDBG PGM(MYPROG) UPDPROD(*YES) DSPMODSRC(*NO)

  7. Release the job queue to process the job.
    At a command line type:
    RLSJOBQ MYJOBQ

  8. When the job is displayed press F10

  9. At command line type:
    DSPMODSRC

  10. Input the break points into your program.
    Press F12
    You may need to Press ENTER to start the process of your program.

  11. After debugging your program:
    End debug
    At Command line type:
    ENDDBG

  12. End Service job
    At command line type:
    ENDSRVJOB


  13. Out of habit verify your job queue is still in released state. You do not want other jobs to be stacked up in there.

I hope you found this tip helpful.

Posted in

Leave a Reply

Discover more from Candy Hein Consulting

Subscribe now to keep reading and get access to the full archive.

Continue reading