News Stay informed about the latest enterprise technology news and product updates.

How to debug a batch ILE RPG

Here is an easy way to debug a batch ILE RPG.

1. Compile your ILE source using DBGVIEW (*SOURCE) OPTION(*SRCSTMT:*NODEBUGIO)

2. Hold the job queue where the program will be submitted

3. Submit the job

4. Hold the submitted job

5. Release the jobq, and if required change the jobq.

6. Start servicing the submitted job using STRSRVJOB JOB(number/user/name) (Start Service job), where "number", "user' and "name" are attributes retrieved from the submitted job.

7. Start the debugger using STRDBG PGM(library/program) UPDPROD(*YES) (Start Debug)

8. You are now in the display module source. Don't try to debug or add breakpoints. It's too early. The job must be active before. Leave this screen using F12.

9. Release the held job.

10. When the job is activated, the start service job window comes. Use F10 to enter debug command.

11. Use DSPMODSRC (Display module source) command to go back to the source and add breakpoint wherever you want, using F6

12. Use F12 to resume the job, and F12 once again to go back to the start service job window.

13. Use Enter to launch the job.

14. The process breaks at the first breakpoint installed and gives you the control.

15. friend

16. When the job is finished, you receive a 'Job being serviced ended' message.

17. Use ENDDBG command to end debug.

18. Use ENDSRVJOB to end servicing


That's all!

Dig Deeper on Debugging