Debug Active Job
If you want to debug a batch job or an already active job you can do that by using
- Submit your program to batch. The job MUST be held. You can either hold the job queue (HLDJOBQ) or hold the individual job (HLDJOB) or specify HOLD(*YES) on the SBMJOB command.
- Use any of the following commands WRKSBMJOB or WRKUSRJOB or WRKACTJOB and find your submitted job. Note that the SBMJOB command gives you an informational message with the job name/number. You need the job name, user ID and job number - the fully qualified job name.
- STRSRVJOB on the held batch job.
- STRDBG on your program. Specify UPDPROD(*YES) if needed. You'll see the source listing if you compiled with DBGVIEW(*LIST) or *SOURCE.
- Press F12 to exit.
- Release the job so that it becomes STATUS(*ACTIVE).
- You'll see a display asking if you want to debug or continue. Press F10 to debug.
- Use DSPMODSRC to see the source listing again. Now you can add your breakpoints if you want.
- Press F3 until you're back to the “debug or continue” display. Press Enter to run the program with your breakpoints set.
- The process breaks at the first break-point installed and gives you the control.
- When you're done, do an ENDDBG and ENDSRVJOB.