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



Hi,

if you want to register a RPG with optional parameters as stored procedures
and overload it, you need to define and check your optional parameters with
Options(*NOPASS: *OMIT). If a overloaded procedure (with optional
parameters) is called, for the not passed parameters a NULL Pointer is
passed, which must be checked as If %Addr(Parm) = *NULL. %Parms always
returns the number of all passed parameters (including NULL-Pointer, i.e.
*OMITTED)


Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Armbruster, Tom
Gesendet: Thursday, 29. October 2009 09:02
An: rpg400-l@xxxxxxxxxxxx
Betreff: Debugging Remote Stored Procedure Calls

All,

I have a conundrum that I can't decipher. I have a program that
contains optional parameters.

d*----------------------------------------------------------------------
--*
d* entry routine
d*----------------------------------------------------------------------
--*
d entry pi
d reqRefID$ 13a varying
d transID$ 13a options(*nopass) const varying
d begDate$ d options(*nopass) const
d endDate$ d options(*nopass) const

reqRefID$ is a return (output) variable in these calls.

If I make the calls from an RPG program, all is well. However, I have
three (3) variations of the call from SQL stored procedures, and only
one is working as expected.

Here are the procedures:

This one works as expected...
CREATE PROCEDURE MYLIB/MYPROCA (
OUT referenceID varchar(13),
IN orderID varchar(13))
EXTERNAL NAME MYLIB/MYPROC LANGUAGE RPGLE

This one returns the OUT variable, but does not produce any records...
CREATE PROCEDURE MYLIB/MYPROCB (
OUT referenceID varchar(13),
IN orderID varchar(13),
IN begDate date,
IN endDate date)
EXTERNAL NAME MYLIB/MYPROC LANGUAGE RPGLE

This one returns the OUT variable, but does not produce any records...
CREATE PROCEDURE MYLIB/MYPROCC (
OUT referenceID varchar(13))
EXTERNAL NAME MYLIB/MYPROC LANGUAGE RPGLE

This is the input logic:
/free
// get a unique key for the request
#get_unique('MYFIELD':k_field$:e_stat$:k_count$);
// if key returned, process request
if e_stat$ = 0;
// set return value
reqRefIDD$ = k_field$;
reqRefID$ = %char(%int(k_field$));
if %parms >= 2;
// select query type
monitor;
transIDD$ = %dec(transID$:13:0);
on-error;
transIDD$ = 0;
endmon;
if %parms >= 2 and transIDD$ > 0;
// get by trans id
exsr getTransID;
elseif %parms = 4 and begDate$ <= endDate$;
// get by date range
exsr getTransIDs;
endif;
else; // no optinal parms passed
exsr loopqueue;
endif;
endif;
// return unique key
*inlr = *on;
/end-free

These stored procedures are being called from ColdFusion on a remote
server.

Is there any way that I can invoke debugging during the remote call to
see what the program is receiving as input?

Thanks,
Tom Armbruster

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.