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



Hi everyone
We have a procedure in a service program that I need to create an SQL function for
I have created SQL functions in the past, but this one is giving me headaches
Before I forget - we are on V7 r1
The procedure uses the following parameters
D FnRtEbsCst pi 149a
D ItmNum 5S 0 Value
D Suffix 4A Value
D LblCode 2A Value
D Prefix 2S 0 Value
D NbtyUom 2A Value
D WhsNbr 3S 0 Value
D EnvCode 1A Value
D Type 2A Value
D

This is what I have used to create the SQL function
CREATE FUNCTION PRODPA.EBSCST (
NUMERIC (5, 0),
CHAR(4),
CHAR(2),
NUMERIC (2, 0),
CHAR(2),
NUMERIC (3, 0),
CHAR(1),
CHAR(2) )
RETURNS CHAR(146)
LANGUAGE RPGLE
SPECIFIC PRODPA.EBSCST
DETERMINISTIC
NO SQL
RETURNS NULL ON NULL INPUT
NOT FENCED
EXTERNAL NAME 'PRODPA/FNRTEBSCST(FNRTEBSCST)'

When I try and use this function in an SQL query
select isuffx, skuno, istat, idescr,
prodpa.EBSCST(decimal(substr(skuno, 2, 5),5, 0),
isuffx, char(' '), 00, CHAR('EA'), 3, CHAR(' '), CHAR('FG'))
from prodfa.itmmstp
where isuffx = '0011' and skuno = '052800'

I get a decimal data error
I have a test program that runs the procedure using the same parameters - no problem - so I know its NOT the procedure
I have used debug on the procedure and running the SQl function
The debug shows that the input parameters are hieroglyphics
I have also created the function using DECIMAL instead of NUMERIC with the same decimal data error

Does any one have any ideas as to what I am doing wrong?

As always - all responses gratefully accepted
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill


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.