|
So creating a separate function expecting VarChar that pointed to a
separate procedure that expected a Varying field did the trick.
Admittedly, I never pass Varying fields into non-Varying parameters
in RPG, but I thought that the Const keyword would convert the value
as it does with zoned to packed and so on. I guess that is not the
case.
Thankfully SQL supports overloading, so the user can use the same
function name regardless of the file's field type.
CRPence on Sunday, April 15, 2012 12:35 AM
On 13-Apr-2012 13:44 , Kurt Anderson wrote:
<<SNIP>>
Here is my Function:
Create or Replace Function ccdlib/isTollFree ( ANI Char(20) )
returns Char(1)
language rpgle
no sql
external name 'CCDLIB/ANIPROCS($ISTOLLFREE)'
parameter style general
The service program procedure's prototype:
// Is the Number Toll-Free?
D $isTollFree PR n
D NPA 20a Const
Am I doing something wrong?
I see nothing wrong with that.
I tried changing the function parameter to VarChar, but that
didn't resolve the issue.
<<SNIP>> Changing to define the function to have VARCHAR input
would typically be done to avoid a sql0440. However changing only
the UDF to have ANI as input to VARCHAR, leaving the storage
required by [as defined by] the called procedure as char(20),
would cause the procedure to see the two-byte varchar length as the
first two bytes of the char(20) data... which is not very helpful.
In that case, expectations would be that the procedure would have
been originally designed or redesigned to have NPA declared as
"varying", or else probably all invocations would return false
[per the two-byte variable length mis-compare problem].
As an Amazon Associate we earn from qualifying purchases.
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.