Debugging RPG/400 (OPM and ILE) with Embedded SQL Statements

Technote (troubleshooting)

Problem(Abstract)

Resolving the problem

This document describes the procedure for debugging RPG/400 and ILE RPG programs containing embedded SQL statements. The command CRTSQLRPG and its ILE counterpart CRTSQLRPGI offer no parameters to generate optional debugging views. To produce a debugger-viewable version of the source code, do the following:

OPM RPG/400 Procedure:

CRTSQLRPG PGM(member_name) OPTION(*NOGEN)

This expands the embedded SQL statements into RPG specifications and creates a member of type RPG in QTEMP/QSQLTEMP. The new member will have the same name as the original SQLRPG member.

This creates a debugger-viewable ILE RPG program object, which can be debugged using STRDBG.

Note:STRDBG has to be used for both OPM and ILE programs. ISDB (which only operates on OPM programs) will bring up the original (not the preprocessed) version of the source code from the SQLRPG member; this mismatch between the program object and the source code retrieved by the debugger may cause errors during the debugging session (notably MSGCPF1920 when trying to set breakpoints with the <F6> function key).