Chapter 15. Using PL/I or COBOL DB2 stored procedures with WebSphere Studio Enterprise Developer 347
Figure 15-22 Removing a stored procedure
Click Yes when the dialog box opens asking if you want to drop your stored procedure. The
DB Output view shows whether the stored procedure was successfully removed from the
remote system or if an error occurred. Figure 15-23 shows a successful remove.
Figure 15-23 Successful stored procedure removal
15.6 Changing a stored procedure
Currently, the only way to change a stored procedure is to remove it from the remote system,
change its definitions in the Data Definition view, and build it again.
15.7 Debugging a stored procedure
To debug a stored procedure, it must be built with specific compile and runtime options. A
compile listing is also required for COBOL stored procedures.
Note: When dropping a stored procedure, you are only removing its definition in DB2. All
your work is still there in the WebSphere Studio Enterprise Developer workspace and the
z/OS data set. After making the necessary changes, you simply need to rebuild it.
348 Exploring WebSphere Studio Enterprise Developer V5.1.2
We use the following steps to debug our example:
1. Remove the stored procedure from the remote system. Using the DB Servers view, select
the stored procedure, right-click, and select Drop 390 Stored Procedure.
2. Specify a compile option TEST and add the necessary debug information (IP address).
Using the Data Definition view, select the stored procedure to be modified, right-click, and
select Open 390 Stored Procedure.
a. Click the Options tab in the Editor view and select the Build Stored Procedure for
Debugging option. This will fill in the Runtime options field with the required
parameters. Figure 15-24 shows our example. Note that the IP address could change
dynamically and you will need to do this again when moving to another IP address.
Figure 15-24 Selecting Build Stored Procedure for Debugging
b. Click the Build tab in the Editor view and type TEST in the Compile options field, as
shown in Figure 15-25.
Figure 15-25 Specifying the TEST option for compiling the stored procedure
c. Store the changes by pressing Ctrl+S.
3. The generated runtime options from the Options page are propagated to the DDL page.
Click the DDL tab in the Editor view and store the modified CREATE PROCEDURE, as
shown in Figure 15-26 on page 349.
Chapter 15. Using PL/I or COBOL DB2 stored procedures with WebSphere Studio Enterprise Developer 349
Figure 15-26 DDL generated with debug in effect
4. Build the stored procedure, as described in 15.3.2, “Process for building a DB2 stored
procedure” on page 342.
5. Run the stored procedure, as described in 15.4, “Running a stored procedure” on
page 345. Complete these actions:
a. Enter a wrong ACTION, such as xxx and 0 as CUSTID, and click OK.
b. The Debugging perspective opens automatically when the stored procedure has been
invoked. Click OK if the following message appears:
EQA2383I The environment is not yet fully initialized. Use Step or Run.
c. Using the COBOL Editor view, scroll the program down and set a breakpoint by
double-clicking the gray vertical bar on the right side of the Source view, as shown in
Figure 15-27.
Figure 15-27 Setting breakpoints
d. Click the Resume button on the menu bar of the Debug view to run from one
breakpoint to the next.
e. Click the Step Into button on the menu bar of the Debug view to step from one
statement to the next. Note that since xxx is an invalid action, a message will be sent
and the stored procedure will be ended. But, we do not want that.
350 Exploring WebSphere Studio Enterprise Developer V5.1.2
f. Using the Variables view, change the contents of the ACTION. Click ACTION and
change the value to ‘SEL’ and click OK, as shown in Figure 15-28.
Figure 15-28 Changing variable contents during the debug
g. We need to execute the Evaluate statement again. Using the COBOL editor, browse
back to the statement where the evaluate statement is defined, right-click, and select
Jump To Location, as shown in Figure 15-29.
Figure 15-29 Jump To Location when debugging
h. Click Step Over and note that the program will behave differently now.
i. Note that by moving the cursor to some fields in the COBOL program, we can see its
contents. Figure 15-30 on page 351 shows our example where we are inspecting the
value of the field SQLCODE.

Get Exploring WebSphere Studio Enterprise Developer V5.1.2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.