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.
- 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
- Place the job queue on hold. In our example, the job is submitted to MYJOBQ
At a command line type:
HLDJOBQ MYJOBQ - Submit the job that you need to debug.
- Locate the job and note the job name, user id and job number.
- Start service job.
At a command line type:STRSRVJOBpress F4
Input the job name, user id and job number from step number 4 above - 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) - Release the job queue to process the job.
At a command line type:
RLSJOBQ MYJOBQ - When the job is displayed press F10
- At command line type:
DSPMODSRC - Input the break points into your program.
Press F12
You may need to Press ENTER to start the process of your program. - After debugging your program:
End debug
At Command line type:
ENDDBG - End Service job
At command line type:
ENDSRVJOB - 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.
Leave a Reply