Debugging ILE program in batch
From MidrangeWiki
Brad Stone has a FAQ entry that addresses this: http://bvstools.com/faq.html#RPG
If that site is unavailable, here is a list of steps culled from posts to RPG400-L:
Using the Green Screen debugger:
- 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.
- 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
- 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 - you cannot set a breakpoint yet.
- 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.
- DSPMODSRC to see the source listing again. Alternately, press F10 to step into the first instruction.
- Now you can add your breakpoints.
- Press F3 until you're back to the "debug or continue" display. Press Enter to run the program with your breakpoints set.
- When you're done, do an ENDDBG and ENDSRVJOB.
Thanks to Bob Slaney, Phil, Patrick Conner and Kelly Fucile.
Using the IBM Distributed Debugger:
- SBMJOB CMD(CALL PGM(yourlib/yourpgm)) JOBQ(yourlib/yourjobq) HOLD(*YES)
- Start your Code debugger from Start->Programs->WebSphere Development... ->IBM Distributed Debugger->IBM Distributed Debugger
- Select the debugger Start up window and key into the job name entry field */##########/* where ########## is your user id.
- You may have to log in and specify the AS/400 system name.
- Select the job that is being held in yourjobq.
- Click the ok push button.
- Enter the library and program name into the Program entry field
- Click the Load push button on the debugger Startup information window. A debugger message will appear telling you to start the program.
- Click Ok on the message push button, even though it tells you to start your program first.
- Switch to a 5250 emulation window.
- WRKJOBQ JOBQ(yourlib/yourjobq)
- Release your job.
Answer courtesy Rob Berendt via RPG400-L 2 Aug 2001