STRDBG Can Be GUI!

Article ID: 20545

In the past two newsletters, I've presented some information about debugging in 132-column mode. That green-screen interface is nice, but this week I've found something better: the iSeries System Debugger.

This debugger is a GUI interface to the debugging facility on the iSeries. It does everything that the green screen program does, plus much more. Here are some of the advantages it has over the green screen debugger:

  • A GUI screen with help files, pull down menus, and a graphical look and feel that makes it easy to use.
  • It can debug PASE programs, Java programs, ILE programs, and OPM RPG and CL programs.
  • When you tell it to monitor the value of a variable in your program, you can check an option called "watch" that will automatically display any changes made to your variable on the screen.
  • Works with interactive programs on the iSeries. You can use it with any terminal emulator. The screens display in the emulator, while the debugging happens in a separate window.
  • Works with batch jobs as well. If you don't know the job identifier of the job you want to debug, you can click "browse" to get an interface where you can select a job from a list.
  • It's lightweight. Unlike the Distributed Debugger that comes with WDSc, the system debugger will run respectably well on a 400mhz PC with only 128mb of RAM!
  • It's written in pure Java, so it can be run from any workstation that's capable of running Java programs.

That last item is a big deal for me. My favorite operating system is FreeBSD, which is a free Unix-like operating system that is like Linux in many ways. One of my perpetual frustrations with IBM's GUI tools like iSeries Navigator and WDSc is that they only work on Windows. I don't think IBM realizes this, but by only making their new updated tools for Windows, they're basically telling us, "To choose the iSeries is to choose Windows." So, when I learned that the iSeries System Debugger runs on any system, I was pleasantly surprised.

Of course, this debugger also works on Windows, Linux, and Mac systems.

The debugger was officially released with V5R2 of OS/400, but it can be installed on a V5R1 system by installing two PTFs, SI02871 and SI02849. You'll also need the IBM Toolbox for Java (5722-JC1) installed on your iSeries. Once installed, you can start the iSeries side of the debugger on your V5R2 or later system by typing the following command:

STRTCPSVR SERVER(*DBG)

Or, on a V5R1 system, you can start it by typing the following:

 CALL QSYS/QTESSTRSVR 

You'll also need to install the user interface on the workstation that you'd like to do the debugging from. To do that, take the following steps:

  1. If you don't already have it, you'll need version 1.3 or later of the Java Runtime Environment installed on your PC. You can download this from IBM's DeveloperWorks Web site at the following link:
    http://www-128.ibm.com/developerworks/java/jdk/

    You can also get the JRE from Sun's Web site at the following link:
    http://java.sun.com/downloads/index.html

    Or, if you're a FreeBSD user like me, you can install it from the ports collection. I installed mine from the following port directory:
    /usr/ports/java/jdk14
  2. I created a directory to install my system debugger files into. On my Windows system, I called the directory C:\SysDbg
  3. You'll need to get the jhall.jar file from Sun's JavaHelp package. If you have WDSc installed, you can copy that file from the C:\WDSC\JAVA directory to the C:\SysDbg directory. If you don't have WDSc installed, you can download the JavaHelp software from Sun's Web site at the following link:
    http://java.sun.com/products/javahelp/
  4. You'll also need to copy two JAR files from your iSeries to the C:\SysDbg directory. The two files are called jt400.jar and tes.jar, and you can find them in the /QIBM/ProdData/HTTP/Public/jt400/lib directory of your IFS.

Once you have everything installed, you need to add the JAR files that you downloaded to Java's CLASSPATH and launch the Debug Manager. On my Windows system, I wrote a little .BAT file to do this. I called it DebugMgr.bat, and it contains the following code:

@echo off
set CLASSPATH=%CLASSPATH%;c:\sysdbg\jhall.jar
set CLASSPATH=%CLASSPATH%;c:\sysdbg\jt400.jar
set CLASSPATH=%CLASSPATH%;c:\sysdbg\tes.jar
java utilities.DebugMgr

If you're running a Unix-like system such as FreeBSD or Linux, you'll have to use a different directory and set up the CLASSPATH in a shell script instead of a batch file.

To start the debug manager, simply run the batch file. If all is well, a Window entitled "iSeries Debug Manager" will pop up on your screen. The next step is to click Edit|Add System to connect the debug manager to your iSeries.

Once the debug manager has been connected, the user-id that you signed on with will be registered to use the iSeries System Debugger. If you have additional iSeries systems that you'd like to connect to, you can click Edit|Add System again to add them. Likewise, if you have alternate user names on your iSeries, you can register them for use with the GUI debugger by clicking Edit|Add User.

There are three ways to start an actual debug session in the iSeries System Debugger.

  • One way is to click Debug|Start Debug from the debug manager. I've found this to be the easiest way for batch jobs.
  • You can also start it using the STRDBG command from the iSeries, the same command that you'd use for the green screen tool. When your userid is registered through the debug manager to use the GUI debugger, STRDBG will automatically start it instead of the green screen one.
  • You can also start the debugger from the Windows command prompt by typing (though I don't see why you'd want to) the following command:
    java utilties.Debug

The iSeries System Debugger is a modern, powerful tool for debugging your iSeries programs. If you're used to the green-screen tools, there might be a learning curve before you have the hang of it, but once you're beyond that curve, you won't want to go back!

ProVIP Sponsors

ProVIP Sponsors