Toad for DB2 to has a very nice SQL procedure debugging facility built into it, both for the DB2 on ZOS as well as DB2 on LEW. Now to invoke that debugging facility, you have to make sure that your procedures, your SQL procedures, have been built with debug mode enabled. If they are, you can invoke the debugger on DB2 or LEW by right clicking on a procedure and selecting debug.
Now if there are any parameters associated with that procedure, this screen will come up, allowing you to specify those values for input parameters for your procedure. If you click OK, then the next screen that Toad will display is a debugger screen. And it looks a lot like a SQL editor screen, but it's got a lot of different and more advanced controls associated with that.
So for example, you could set breakpoints by clicking in the gutter and setting a breakpoint there. And then you could actually have display things like a watch window, and if you have run a debugger before, Toad's going to keep track of your variables that you've watched, so when I open this watch window, it is actually showing the previous values that I set. So it gives you a little benefit there.
And then when you're ready, you can hit run, and the run will take you to run the entire procedure unless you have a breakpoint that gets hit, and then it will stop. So I've clicked run, and Toad is now communicating with the server. And is going to execute a few statements up until the first breakpoint.
And you can see, we've got step over buttons that allow you to step over certain statements if you wish, and once things are updated, you can see in my watch window as variables get updated, they will be updated in a watch window down here. So you can just essentially step over stuff around step through like a normal debugger that you might be accustomed to for various programming languages.
So very easy to set breakpoints to interrogate variables and expressions and update variables and expressions and run a debugger for PLSQL and SQL procedures for DB2 ZOS LEW as well as DB2 ZOS.
I'm just going to click run here and have this procedure run. So that is debugging SQL procedures for Toad for DB2. And if you hover over values, you'll get the values that are set, just like typical debuggers that you might find for other vendors or for like programming language vendors.