An SQL procedure is an ILE C program with embedded SQL. I posted an excerpt
from one of my courses that shows how to retrieve the ILE C source code. So
if you are debugging the SQL Proc, you might find it useful to have the C
source available also.

Craig Pelkie

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Gary
Sent: Tuesday, September 02, 2014 3:08 PM
To: Midrange Systems Technical Discussion
Subject: Re: testing an SQL procedure

Thanks again to Rob, Chuck and Buck.

Using embedded SQL I can now call the SQL proc and get the desired doc_num

out_loc = 'ABCD';
cto_num = 1234567;
bat_dat = 1140902;
doc_num = *Blank;
Exec SQL CALL mysqlproc (:out_loc, :cto_num, :bat_dat, :doc_num);

Setting Break Points in the SQL proc worked but I was surprised at the
number of F10-Step and F12-Resume key presses needed to run the proc ?

Next step is making the SQL proc query to get the library/schema name from
the out_loc input parm.

We have a local file which stores library by out_loc, but any hints on
coding this in an SQL proc will be very much appreciated.
(I'm reading 'Stored Procedures' and '7.1 Database SQL' pdf's)

One question I have is what exactly makes an SQL statement 'dynamic' ?

I recently saw a statement that changing a table name requires dynamic SQL,
and have thought for some time that using dynamic sql is more reliable when
switching libraries so that's been my habit for some time.

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page