Debugging OPM program in batch

From MidrangeWiki
Revision as of 22:05, 13 February 2008 by FKOL (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

Categories