Thursday, June 5, 2008

Debugging RPG Called from Java - JDBC

Debugging an RPG program called via JDBC is a simple but multi-step process.

Before starting, you may need to update the Library List of the Job Description used in the job. The JOBD will be the one associated with the User Profile used in the JDBC connection string.


To STRDBG on an RPG called via JDBC -

1. In Eclipse / WebSphere / RAD IDE, put a breakpoint on a statement after the connection to the AS400 is made but before the Statement (or CallableStatement) is executed.

2. Start debug on the Java and progress until you get to the breakpoint just set.

3. Now, go to the greenscreen and WRKJOB QZDASOINIT STATUS(*ACTIVE)

4. Find your job (the most recent one, usually).

5. STRSRVJOB on that job.

6. STRDBG on the program. When the program is displayed, I usually press F10 (STEP) to continue but you can set a breakpoint and press F6 (setting a breakpoint) and F12 (RESUME) to continue.

7. Back in the IDE, press F6 to STEP through the statement execution. This starts the RPG program in Debug. You'll see the program in debug in the green screen.