Hi,
instead of defining 2 RPG functions, a single one will be enough.
But you have to define your optional parameters as OPTIONS(*NOPASS: *OMIT)
and check whether the pointer for the parameter is passed.
That means:
If %Parms = 3 or %Addr(Parm3) <> *NULL;
//Parameter 3 is passed by either RPG or the SQL function
EndIf;
SQL functions can be overloaded, that means you can create a function with
the same name in the same schema for each possible parameter definition.
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 loosing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Mark Walter
Gesendet: Friday, 03. October 2008 20:40
An: RPG programming on the AS400 / iSeries
Betreff: RE: %parms() BIF
Well that just sucks.......
Ok, in order to make the procedures more intuitive, I just separated them
into two separate procedures. getCashByAcct, and getCashAllAccts.
Thanks,
Mark
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Rory Hewitt
Sent: Friday, October 03, 2008 2:08 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: %parms() BIF
Mark,
SQL doesn't pass a basic operational descriptor, unlike RPG. It is this
opdesc which lets the RPG subprocedure know how many parameters have been
passed. The same goes for some other languages (no doubt someone else will
chime in which ones they are, if you're interested...).
Anyway, to solve your probelm, the easiest thing to do is to add code to
your RPG sub-procedure to treat blank parameters as equivalent to un-passed
parameters, and then pass those parameters as blank from the SQL function.
Rory
On Fri, Oct 3, 2008 at 10:44 AM, Mark Walter <mwalter@xxxxxxxxxxxxxxx>wrote:
I have a sub-procedure in a service program that uses the %parms()
bif. If I call the sub-procedure from RPG, it works fine. However, if
I call it from an SQL External function, it returns -1. Any idea why?
Thanks,
Mark
Mark Walter
Certified IBM System I Specialist
Paragon Consulting Services, Inc
http://www.paragon-csi.com
mwalter@xxxxxxxxxxxxxxx
717.764.7909 x126
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
No virus found in this incoming message.
Checked by AVG -
http://www.avg.com
Version: 8.0.173 / Virus Database: 270.7.5/1705 - Release Date: 10/3/2008
8:18 AM
As an Amazon Associate we earn from qualifying purchases.