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




My guess is that the parameters are getting treated like a VARCHAR instead of a CHAR unless you explicitly cast them to a CHAR. I've written several stored procedures that define parameters as CHAR and I've not had a problem using them from programs (both RPG and Java).

One thing that may make life a little easier for you is to pass in numeric data instead of character data. A long and two integers should work for your parameters and should also cut down on the amount of garbage that could be passed in. For example, the way it is right now, your program could be called like this: myedit('Silly', 'Am', 'I'). What would it do if that was passed in? If the parameters were numeric, it wouldn't even be called.

Matt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of John Rusling
Sent: Tuesday, November 18, 2008 4:33 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: SQL external UDF in RPG.

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.

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


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.