Possibly a silly question, but did you set a break point in the RPG?

I was working on a UDTF a few months ago and it seems to me that I had no problem with the debugger, but it's a bit hazy now.

Sam

On 1/27/2014 3:30 PM, Buck Calabro wrote:
Question: Is there a special setting I need to make in order to debug a
user defined table function which is written in ILE RPG?

Details:
I'm making my first foray into writing a User Defined Table Function in
ILE RPG. I thought I had some issues understanding the mapping between
the CREATE FUNCTION and the RPG parameter list, so I thought I'd make a
stub, fire up IBM i Navigator's Run SQL function, put the RPG in SEP
debug and look at the values for the fetch in debug.

For those unfamiliar with the way an RPG UDTF works, the database CALLs
the RPG program multiple times to fulfill a single table() request. One
of the parameters the database provides is the 'call type'. So:

select * from table(table(buck.sqludtf(3)) as src;

1) DB calls SQLUDTF with call type -1 (open)
RPG program does an OPEN CURSOR
2) DB calls SQLUDTF with call type 0 (fetch)
RPG program does a FETCH NEXT
RPG program sets the outbound SQLSTATE
RPG program returns
3) DB checks SQLSTATE returned by RPG program.
If SQLSTATE normal, repeat step 2
Otherwise, DB calls SQLUDTF with call type 1 (close)
4) DB collates the returned 'rows' from the RPG program into an SQL
table and presents the table to the rest of the SQL statement.

The RPG program runs, fires the SEP debugger, and I can step through the
'open' section with no problem. The RPG does the return (as expected)
and then the SEP debugger reports that the program terminated and the
results show up in the SQL Navigator window! I expected that the SEP
debugger would go through at least one each of 'open', 'fetch' and
'close', since the program itself did, but that doesn't happen.

Recap:
The UDTF works fine. It does get called multiple times and the program
code physically executes, as I can see the results. The SEP debugger
only stops during the first pass through the program. The green screen
debugger STRDBG works as expected (stopping during every invocation of
the program).

--buck


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.