navigation graphic

Resources

PHP Resources RPG Resources Debugging Resources RDi Resources Windows 10 & IBM i CL Resources Our Videos Hot Tips!

Resources

product

Debug Alternatives

In this resource article, we wish to take you through debugging our RPG programs, or service programs, with a tool some readers may not have come across. This tool is the IBM System Debugger.

It is a client based tool that has the following advantages over the Rational RDi debug facility:

  • It is part of the base IBM i operating system, so no individual licensing cost, as with RDi
  • Small footprint, a couple of Megabytes compared with over a Gigabyte for the RDi
  • Quicker to start
  • Less memory intensive

I am sure the 'no cost' bullet point will prick a few readers and managers ears.

The IBM System Debugger is included as part of the Toolbox for Java (57xx-JC1) licensed program which is included with the IBM i Operating System.

If you have not used any of the graphical debugging tools available, give them a try, they are so much easier than trying to debug, for example, a batch program using the 5250 commands.

Installation

Installation of this product is quick and easy, in fact, you could barely call it an installation. The only pre-req we have is that JRE (Java Runtime Environment) is installed on your PC. If this is missing, it can be obtained from the JAVA.COM website. The debugger is packaged in a couple of JAR files with IBM Toolbox for Java.

The only files we need are JT400.JAR and TES.JAR.

These can be found on our IFS, in the \qibm\ProdData\HTTP\Public\jt400\lib directory. Copy these two files to somewhere on your PC. I placed them in a new directory called iDEBUG to give the grey cells a bit of a fighting chance of knowing what was in there. For Java to find this product, we have to give it a clue where to look for the debugger. This is down to a local environment variable called CLASSPATH. We need to place the names of the JT400.JAR and TES.JAR into this variable. This is achieved by navigating into control panel, then selecting System (the Windows Key and Pause is an excellent shortcut), then Advanced system settings, Environment Variables.

This can be seen in the figure below.

debug

Optionally, if you need to install the help feature with this product, we need to install another jar file. This file called jhall.jar can be downloaded from the Java website. Once you have downloaded it, place it in the same directory as the other two jar files. Also, remember to amend your CLASSPATH variable, and you now have the help features installed. And that’s it, installation complete!

Starting a Debug Session

Open a windows command box, or DOS prompt for us old uns, and enter java utilities.Debug. Being good old Java beware of case when entering this.

debug

This will fire up the debugger.

debug

For ease, I created a shortcut on my desktop that runs the Java command, saves my typo's!

debug

Using the Debugger

To select a program, or a job, to debug, press the F4=Debug key.

debug

The debug user interface is split into four windows. The Program Explorer, in the top left hand panel, the program source in the top right, program variables in the bottom left and finally, the program call stack information in the bottom right. Apart from the source window, the other windows have tabs included so that you can find other information. The figure below shows the user interface with its most common settings.

Just as with debugging on the green screen, if we do not have debug information included in the program being debugged, the source will not show in its window. Hopefully, you have the source and can recompile it using the debug view parameter on the relevant compile command.

debug

For those of us who prefer using the keyboard instead of a mouse, here are the common keyboard shortcuts.

Keys   Description
F4   Start Debug
Shift+F4   End Debug
F2   Add a program
F3   Pause
F12   Resume
F11   Step over
Alt+F11   Step over, skipping breakpoints
Shift+F11   Step into
Ctrl+F11   Step out
Ctrl+Alt+F11   Step out skipping breakpoints
Shift+F12   Run to cursor
Alt+F12   Run to cursor, skipping breakpoints
F6   Add breakpoint
F7   Enable breakpoint
Shift+F7   Disable breakpoint
Shift+F6   Remove breakpoint
Alt+F7   Remove all breakpoint

Conclusion

It is not our intention in this article to belittle the Rational debug facilities, we find them excellent, but this article is about giving you an alternative and at no cost!

To conclude, if you are still using the green screen commands, STRDBG and STRISDB to maintain your applications, why not give the System Debugger a try, I'm sure you will be pleasantly surprised by its features and functionality.

  follow us on twitter   find us on facebook   follow us on linkedin   see our videos   find us on google+