Differences

This shows you the differences between two versions of the page.

Link to this comparison view

debug_active_job [2018/08/01 10:08]
debug_active_job [2021/04/05 11:23] (current)
Line 1: Line 1:
 +====== Debug Active Job ======
  
 +If you want to debug a batch job or an already active job you can do that by using ''STRSRVJOB''.
 +
 +  - 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.
 +
 +Original post: http://www.mysamplecode.com/2011/05/rpgle-debug-batch-job-strsrvjob.html
 +
 +{{tag>ibm}}