One command on the top of Search400.com member Vince Shank's list is STRSRVJOB. He says this command is great for...
debugging batch programs. Here's how he uses it:
"What I do is put the jobq that the job is going to be submitted to on hold (HLDJOBQ jobq(qbatch)). Then I submit the job. Then put the job on hold. Then release the JOBQ (RLSJOBQ JOBQ(QBATCH)). Take an option 5 on the job. At the top of the screen you see the parms that you need to enter into the command STRSRVJOB (Number/User/job). Now you can STRDBG PGM(program name) and add break points. Then all you have to do is release the job. It's much easier than it sounds.
"You have to release the job first before you start the debug. The reason being, the job must be active in order to debug a particular program. I usually paste the command after releasing the job then press F10 so the debug stops at the first line. Then once the debug panel appears, break points can be added. In other words, you have to be quick depending on how fast the batch job reaches the program you want to debug.
"Another trick can be to call a program that has a delay job (DLYJOB) for the amount of time required to STRSRVJOB and start debugging. That way you don't have to hold jobq(s) and RLSJOBQ(s)."
Here are a couple more tips that use STRSRVJOB:
- Simple screen capture
Here is a simple technique for capturing the information on a screen and using it in a program. This program eliminates a lot of typing when using the STRSRVJOB command to debug several jobs.
- Two more tips on batch debugging
In his second tip in this article, Search400.com member Pete Sadler points out how helpful STRSRVJOB is when servicing a batch job.