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



Well, it must be UDF problem week where I am. I posted to the RPG list
since there is an RPG/SQL partnership involved.



System is at V5R3M0



I have created a new SQL function with a partner RPGLE *SRVPGM (because
really there are bunches of functions). A sample CREATE FUNCTION looks like
this:

CREATE FUNCTION MYLIB/perAccum(CHAR(9),DECIMAL(4,0)

, DECIMAL(2,0),DECIMAL(11,2)

, VARCHAR(1), VARCHAR(32))

RETURNS DECIMAL(13,2)

RETURNS NULL ON NULL INPUT

LANGUAGE RPGLE

EXTERNAL NAME 'MYLIB/DTACVTFN(accumValue)'

NOT DETERMINISTIC

NO SQL

NO EXTERNAL ACTION

PARAMETER STYLE SQL

ALLOW PARALLEL

NOT FENCED



The prototype that goes with this one looks like this:

D accumValue PR 13P 2 ExtProc('accumValue')

D employee 9 Const

D year 4P 0 Const

D month 2P 0 Const

D amount 11P 2 Const

D accumType 1 Const Varying

D accumName 32 Const Varying



The issue that I have is that any use of this function is returning Decimal
Data error (MCH1202), and I have not been able to figure out why. The
values are in fact returned, and they are in fact valid from RPG's
perspective (I've proven with code like the following)

/If DEFINED(DEBUGGING)

msg = 'accumValue() returning ' + %char(rtnvalue)

+ ' for accumulator ' + %Char(I)

+ ' of ' + %Char(nbrAccums) ;

sndPgmMsg('CPI8859': msg) ;

/EndIF

Return rtnValue ;



I also tried changing from "13P 2" to "13S 2", but that didn't change the
symptom. Can any of you tell me what I've done wrong here, or tell me what
else you need to see in order to be able to assist? I'm missing it! (BTW:
I have also verified that the incoming data is all valid decimal data; it's
the return that's failing.)


Thanks!



Dennis E. Lovelady
AIM/Skype: delovelady MSN: fastcounter@xxxxxxxxxxxx
<http://www.linkedin.com/in/dennislovelady>
www.linkedin.com/in/dennislovelady --
Give a man a fish and he will eat for a day. Teach a man to fish and he will
sit in a boat all day drinking beer.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.