|
I'm recieving unexpected values when using %parms on a procedure called via
an SQL UDF.
Here's my procedure (located on a *SRVPGM), it basically wraps the call to
PadR(), becouse the latter one is coded to handle strings of length not
supported by SQL (65535a):
p PadRSQL B export
d PadRSQL PI 5000a varying
d str 5000a const varying
d len 5p 0 const
d pchr 1a const varying options(*nopass)
d cp s 5i 0
d RtnStr s like(PadRSQL)
c eval cp = %parms
c if cp = 2
c eval RtnStr = PadR(str: len)
c else
c eval RtnStr = PadR(str: len: pchr)
c endif
c return RtnStr
p PadRSQL E
I've created two copies of the UDF with the same name having two and three
parameters:
CREATE FUNCTION
PADRSQL2 (pSTR VARCHAR(5000),
pLEN DEC(5),
pCHAR VARCHAR(1))
RETURNS VARCHAR(5000)
LANGUAGE RPGLE
EXTERNAL NAME 'BABIB/PADR(PADRSQL2)'
SPECIFIC PADRSQL2A
DETERMINISTIC
NO EXTERNAL ACTION
PARAMETER STYLE GENERAL;
CREATE FUNCTION
PADRSQL2 (pSTR VARCHAR(5000),
pLEN DEC(5))
RETURNS VARCHAR(5000)
LANGUAGE RPGLE
EXTERNAL NAME 'BABIB/PADR(PADRSQL2)'
SPECIFIC PADRSQL2B
DETERMINISTIC
NO EXTERNAL ACTION
PARAMETER STYLE GENERAL;
Always i call the function i get -1 returned by %parms, which leads to an
inappropiate behavior.
Is %parms not allowed when calling from an SQL UDF ? i've never read
anything like this....
Thanks in advance...
Carlos Kozuszko.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.