× 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.



Adding a Service Entry Point is the best way to debug a program.
Do you have RDp?

Glenn Gundermann

-----Original Message-----
From: "Thomas Garvey" <tgarvey@xxxxxxxxxx>
Sender: midrange-l-bounces@xxxxxxxxxxxx
Date: Mon, 4 Mar 2013 16:37:45
To: 'RPG programming on the IBM i \(AS/400 and iSeries\)'<rpg400-l@xxxxxxxxxxxx>
Reply-To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Cc: 'Midrange Systems Technical Discussion'<midrange-l@xxxxxxxxxxxx>
Subject: Help with debugging external UDF

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.