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



On Tue, 2008-11-18 at 15:33 -0600, John Rusling wrote:
I've written an RPG program, (not service program), and wrappered it as
an SQL external UDF.

I pass in a string, length, and # of decimal places.

It will format a number (string), according to the length and # of
decimal places that i pass in and return the formatted string.

I made all parameters and the return parameter character.

The create function is here -

CREATE FUNCTION JRPERS/MYEDIT
( pInput Char( 15 ),
pRtnValLen Char( 2 ),
pDec Char( 1 ) )
Returns Char( 15 )
External Name JRPERS/MYEDIT
Language RPGLE
No SQL
Parameter Style SQL

In order to test it from interactive sql, i have to use this -

SELECT '1234567', myedit(CHAR(1234567),CHAR(07),CHAR(2))
FROM sysibm/sysdummy1

which (correctly) yields this -

....+....1....+....2....+....3.
Constant value MYEDIT
1234567 12345.67
******** End of data ********

What I can't understand is when I try to run it thus -

SELECT '1234567', myedit('1234567','07','2')
FROM sysibm/sysdummy1

I get this error -

MYEDIT in *LIBL type *N not found.

From reading on the lists, it 'sounds' like a parm mismatch BUT,
everything is character.

Sorry, John, but it ain't so. A string in single quotes, like '1234567'
is actually a VARCHAR, not CHAR. So you really do need to cast those
parameters to match the function definition.

Cheers,
Terry.


Any direction or tips would be greatly appreciated?

We are at v5r4 here.

tia John B.

fyi
The reason for this hoop-jumping is so that I can call it from Extol EBI
edi software for editing character (number) values. The only other
way to do it, from their software, would be write it in java. afaik.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.