Friday, July 3, 2009

(FAQ) How to DEBUG in Batch Mode.

To debug in batch mode, just follow these steps:

a) 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.

b) WRKSBMJOB/WRKUSRJOB/WRKACTJOB and find your submitted job. Note that the SBMJOB command gives you an informational message with the job name/number. What you need is the job name, user ID and job number - the fully qualified job name. Example: 123456/BUCK/MONTHEND

c) STRSRVJOB on the held batch job.

d) STRDBG on your program. Specify UPDPROD(*YES) if needed. You'll see the source listing if you compiled with DBGVIEW(*LIST) or *SOURCE.

e) Press F12 to exit - you cannot set a breakpoint yet.

f) Release the job so that it becomes STATUS(*ACTIVE).

g) You'll see a display asking if you want to debug or continue. Press F10 to debug.

h) DSPMODSRC to see the source listing again. Alternately, press F10 to step into the first instruction.

i) Now you can add your breakpoints.

j) Press F3 until you're back to the "debug or continue" display. Press Enter to run the program with your breakpoints set.

k) When you're done, do an ENDDBG and ENDSRVJOB.

1 comment: