To debug SQL procedures, you first need to launch the Integrated i Debugger. For further information about starting a debug session, see the related topic below.
Make sure that your debug preferences are set to always using the Debugger editor. To set debug preferences, select . Select the Always use Debugger Editor while debugging check box.
Set a service entry point on the generated *PGM object of the SQL procedure. You can do this by right-clicking on the *PGM object and selecting . Then run the program that calls the SQL procedure. When the SQL procedure is called, a debugging session is started automatically.
Alternatively, if you have a caller program which invokes your SQL procedure, you can perform one-step debugging. To do this, locate the caller program in the Remote System Explorer and then right-click it and choose from the pop-up menu. After the debugging session launches, you can run to the line which calls the SQL procedure. After this, stepping into the SQL procedure will cause the source statement of the SQL procedure to display in the Debugger editor. At this stage, you will be able to perform typical debug tasks, such as setting breakpoints, stepping into or over, issuing step returns, and monitoring variables.
If you do not have a caller program for your SQL procedure, you can invoke the procedure with interactive SQL. To do this, launch the debugger with full prompt, as follows: