Informing the IBM Community

Get started with the RPG debugging alternative

5
(1)

Abstract technology background with hexagonal shapes
I wish to take you through the debugging of RPG programs or service programs with a tool some readers may not have come across called 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 up 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 that are 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-requirement 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 old 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 being an excellent shortcut), then Advanced system settings; Environment Variables. This can be seen in the figure below.

AY Aug Figure 1

Optionally, if you need to install the help feature with this product, you need to install another jar file. This file is called jhall.jar and 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.

AY Aug Figure 2

This will fire up the debugger.

AY Aug Figure 3

For ease, I created a shortcut on my desktop that runs the Java command – it saves on my typos.

AY Aug Figure 4

Using the Debugger

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

AY Aug Figure 5

The debug user-interface is split into four windows. The program explorer is in the top-left panel, the program source in the top-right, program variables in the bottom-left and the program call stack information is 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.

AY Aug Figure 6

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+F6 Remove all breakpoints

Conclusion

It is not my intention to belittle the Rational debug facilities – I find them excellent – but this article is about giving you an alternative and at no cost. If you are still using the green screen commands STRDB and STRISDB to maintain your applications, why not give the System Debugger a try? I am sure you will be pleasantly surprised by its features and functionality.

Andy Youens is an IBM i consultant/instructor at Milton Keynes, UK-based FormaServe Systems.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.