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




I have created a function using:

CREATE FUNCTION MINOF (SMALLINT, SMALLINT, SMALLINT,
                       SMALLINT, SMALLINT, SMALLINT)
RETURNS SMALLINT
LANGUAGE RPGLE
PARAMETER STYLE GENERAL WITH NULLS
SPECIFIC MINOF NOT DETERMINISTIC
NO SQL CALLED ON NULL INPUT
EXTERNAL ACTION
FENCED
EXTERNAL NAME 'MAALIB/MINOF(MINOF)'

It's purpose is to simply return the minimum of the 6 input parameters.
The RPG code is trivial.  Here is the prototype:

D MINOF           PR             5I 0
D  A                             5I 0
D  B                             5I 0
D  C                             5I 0
D  D                             5I 0
D  E                             5I 0
D  F                             5I 0
D  INPIND                        5I 0 DIM(6)
D  RESULTIND                     5I 0

If parameter "A" is null then the UDF is not called.  I was able to
determine this, because I hard coded the return value to a number and the
result set returned a null (instead of the number) when "A" was null.  As
soon as I wrap the first parameter in "SMALLINT(IFNULL ( A ,   1235))",
everything works.  This fix doesn't work if I put it on the second
parameter, only the first.  Is there something I am missing?

Regards,

Mark




As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.