× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hiya Tom,

Have you tried the debug option in iNav's Run SQL Scripts? It's under "Run / Debugger".

Might be useful?


On 3/4/2013 4:37 PM, Thomas Garvey wrote:
I am having trouble debugging my external UDF which is called in an SQL
statement. I'm pretty sure I've done this before but it's not working now.
Maybe someone can see what I'm doing wrong, or forgetting.

The UDF is an RPGLE module in a service program. I have a batch program
that 'prepares' a SQL statement from a string, and declares a cursor, opens
the cursor, and performs a fetch, as follows...

SQLCommand = 'Select SpecFunct(char(numericfield), 'special literal') from
library/file';
exec sql
prepare C1 from SQLCommand;
exec sql
declare D1 cursor for C1;
exec sql
open D1;
exec sql
fetch F1 into :Value;
if sqlcod = *zeros;
// do something
endif;
exec sql
close D1;



1. I start debug (STRDBG) on this program and issue an SBREAK on the
first line (SQLCommand =...)
2. I submit the call to the program, along with the library list needed
3. The batch job begins and the program is called and the break occurs
4. I copy the STRSRVJOB job info provided by the system and go to
another session (with the same library list) and paste the STRSRVJOB command
5. I issue another STRDBG in that other session on the program and
issue a break point at the same SQLCommand line of code.
6. I add the service program SpecFunct to the debugged programs and
issue a break point in that service program at the first line of execution
7. I press Enter on the first session to allow the program to continue
execution


Everything works as expected, the program stops and I step through the
original program logic, in the second session. However, I never get to
debug the service program. The system does call something because each step
of the original program returns a zero in SQLCOD, AND it returns a value
from the UDF. The problem is the value is wrong and I can't get to debug
the service program to find what is going wrong.

I know this is a lot of detail and I appreciate anyone's effort to wade
through it.

What am I missing?

Thanks much

Tom Garvey



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.