Difference between revisions of "Debugging OPM program in batch"
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | ||
− | |||
You can follow the steps in [[Debugging ILE program in batch]] and use the old (no source) debugger STRDBG. | You can follow the steps in [[Debugging ILE program in batch]] and use the old (no source) debugger STRDBG. | ||
Line 38: | Line 37: | ||
==Categories== | ==Categories== | ||
− | |||
[[Category:Programming FAQ]] | [[Category:Programming FAQ]] |
Latest revision as of 22:05, 13 February 2008
You can follow the steps in Debugging ILE program in batch and use the old (no source) debugger STRDBG.
Mike Barton suggests compiling the program with OPTION(*SRCDEBUG) and then using STRDBG OPMSRC(*YES), which should work with the steps given above.
STRISDB won't work unless the job is running, so you can't put it on hold and enter your break points.
Martin Rowe contributed the following idea: Insert a simple CL program into your RPG that waits for you to answer a message. This way, the job is running, but not processing yet. (RPG400-L 24 May 2001)
Here is an adaptation of his idea:
Here's the RPG program you're trying to debug:
H 1 C CALL 'DBGWAIT' C Z-ADD1 X 50 C SETON LR
I've inserted "CALL 'DBGWAIT'" and re-compiled.
Here's the source for DBGWAIT:
pgm dcl &reply *char 1 sndusrmsg msgid(CPF9898) + msgf(QCPFMSG) + msgdta('Paused for debug') + msgrpy(&reply) endpgm
STRISDB PGM(BATCHOPM) UPDPROD(*NO) INVPGM(*NO) SRVJOB(*SELECT) You'll see a list of all active jobs on your system. Select the one you're trying to debug. You'll get a message saying that the program is in debug mode. Answer the "paused for debug" message, and the source will pop up after the call to DBGWAIT.