Correction: Bugged by the Bugged by Interactive Debugger Tip
October 26, 2005 Brian Kelly and Joey Maniskas
Editor’s note: Last week, Brian and Joey took a question from Dave regarding the SQL interactive debugger and from the responses we received to the tip, we created as much confusion as we attempted to address. The fact is we got our commands mixed up in the solution. Our sincere apologies for the inconvenience this may have caused anybody out there in iSeries-land. The moral of the story of course is check, double check, recheck, and then check again. Here is the original question followed by two emails from some sharp early bird readers of Four Hundred Guru, Vern and Charles, followed then by the proper answer to the question.
Hey, Brian and Joey:
After having a problem attempting to use the Interactive Source Debugger (ISDB) to debug RPGLE and RPGSQLLE programs, I was so frustrated that I admit I punted. It was the first time I had tried to debug an RPGLE program I had written. When I attempted to start the ISDB debugger (using the STRISDB command), nothing happened. The STRISDB command wouldn’t even open the program.
To make matters worse, a co-worker of mine said that ISDB could not be used to debug RPGLE programs and I was left wondering what I was going to do. I managed to fix my problem without the use of the debugger and moved on. How could I have used the debugger to have solved this problem much sooner?
Now the emails from Charles and Vern:
To whom it may concern,
In the “Bugged by the Interactive Debugger Article,” the question was how do I get STRISDB to work with RPGLE programs. Brian and Joey suggest that the trick is “To use ISDB to debug LE program, when compiling, make sure that the “debugging views” parameter is set to *SOURCE or *ALL.”
However, the fact of the matter is the STRISDB doesn’t work work with ILE programs. When you try it you’ll get a IXA0101 error message.
Message ID . . . . . . : IXA0101 Message . . . . : Program type not valid. Cause . . . . . : Only OPM RPG, CLP and COBOL programs can be debugged. For ILE programs use STRDBG command.
You have to use STRDBG instead.
Even better is the WDSc or CODE debuggers.
To whom it may concern:
I have to differ with what the article said. STRISDB is not made for ILE programs. When I tried to use it with an RPGLE, I got an IXA0101 – Program type not valid. The second level specifically says, “For ILE programs, use STRDBG command.” The RPGLE had all source views available to it.
The reverse (converse? obverse?) is what is true: OPM can be debugged with STRDBG by specifying *SRCDBG or *LSTDBG in the OPTION parameter. Then you specify *YES on the OPMSRC parameter.
So this one got set on its head a bit.
Here is the revised tip:
Dave, to make a long story short, the STRISDB (Start Interactive Source Debugger) command cannot be used for ILE programs. However, IBM has provided a nice alternative with the STRDBG (Start Debug) command.
There are actually two debug commands that make sense historically but do not necessarily make sense when you are first trying to use an AS/400 interactive source debugger. The historically first command is STRISDB. Please note that there is no “G” at the end of this command. This command has been around almost since the beginning of AS/400 time and has been used successfully for years to debug the Original Program Model (OPM) programs such as RPG/400 and CL. The STRISDB command has not been changed in some time and many developers continue to use it for their RPG/400 and straight CL work.
The second command is STRDBG. This debug command does have a “G” at the end, but it has no “I,” even though it is interactive. The STRDBG command puts a job into debug mode and, optionally, you can add as many as 20 programs, 20 service programs and 20 class files to debug mode. You can also specify various attributes for your debugging session. For example, you can specify whether database files in production libraries can be updated while you are debugging.
STRDBG is IBM’s Cadillac debug facility. When you fire it up, the graphical system debugger is optionally launched instead of the traditional system debugger in cases where the user is registered for graphical debugging.
If you have never used an IBM debug command before, STRDBG is the command to use since it can debug all three programming environments, OPM, ILE (Integrated Language Environment), and Java.
Once you choose the STRDBG command as your debugger for ILE programs, it’s all in the options, Dave, but not the options for the debugger. If you take a hard look at the options for compiling an RPGLE program, in the CRTBNDRPG command for example, you will notice a compiler parameter “debugging views” (DBGVIEW). This parameter governs the amount of debugging information that is placed within the compiled object for later source level viewing and debugging. The simple approach to get the most information for debugging is to change this parameter to ‘*ALL’ and then try the STRDBG command on that program. It will work and you will gain plenty of information about the internals of your program while it is executing.
The SQL Debugging Hitch
The Create SQL ILE RPG Object (CRTSQLRPGI) command provides fewer options in its debugging views. You get a choice of *None or *Source. If you choose *None then you see no source at all. If you choose *Source, you see the source for the program while in debug mode but you don’t get the compile listing or the many nice options that exist when compiling an ILE RPG program without the SQL includes. An example of the *Source option shown for SQL RPG debugging with the *Source option follows:
Display Module Source Program: CALLED04X Library: HELLO Module: CALLED04X 1 FLANGUAGE IF E K DISK 2 D ERRMSG C CONST('HELLO WORLD TRANSLAT 3 D ION NOT FOUND, TRY A- 4 D GAIN') 5 D DS 6 D DATA 1 100 7 D LANGUA 1 7 8 D MESSAG 8 80 9 D IND99 81 81 10 C/EXEC SQL 11 C+ CREATE TABLE SAMPLELIB/VENDORP 12 C+ (VNDNBR DEC(5,0), 13 C+ NAME CHAR(25), 14 C+ ADDR1 CHAR(25), 15 C+ CITY CHAR(15), More... Debug . . .
The end result of a CRTSQLRPGI program is an RPGLE type program even though the source type is SQLRPGLE. There is no subtype to tell the debugger that this was once an SQL program. However, despite it being an ILE program, because of the multiple staged compiling for SQL processing with the SQL pre-compiler passing its generated source to the ILE compiler, IBM cannot provide as much information inside of the program. Thus, the option *All is not valid for SQL compilations.
For ILE RPG:
1. Use STRDBG, not STRISDB, to debug ILE programs.
2. When compiling make sure that the “debugging views” parameter (DBGVIEW) is set to *ALL.
For SQL ILE RPG
1. Use STRDBG, not STRISDB, to debug SQL ILE programs.
2. To use STRDBG to debug RPG SQL ILE programs use the Create SQL ILE RPG Object (CRTSQLRPGI) command and when compiling make sure that the “debugging view” (DBGVIEW) parameter is set to *SOURCE.
Our apologies for the confusion.
Brian Kelly retired as a 30-year IBM midrange systems engineer in 1999, having cut his eye teeth in 1969 on the System/3. While with IBM, he was also a Certified Instructor and a Mid-Atlantic Area Designated Specialist. When IBM began to move its sales and support to Business Partners, he formed Kelly Consulting in 1992 as an IT education and consulting firm. Joey Maniskas, who is a programmer/analyst for book publisher WW Norton & Company, is a local colleague of Kelly’s up in Scranton, Penn. She helped out on this tip and its correction.