I have written the following UDF with the intention of returning a table of data consisting of records selected from a live and an archive file:
create function SCANLEDGER(iRefNo char(8))
returns table (File char(10), RefNo char(8), Account char(8),
Status dec(1,0), GLDate dec(8,0), GLSeq dec(7,0),
TranType char(2), GrossAmt dec(13,2), TaxAmt dec(13,2),
TranStat char(2))
language SQL
begin
return
select 'LEDGER', REFNO, digits(AccNo) || AccSfx,
STATUS, GLDATE, GLSEQ, TRNTYP, GROSS, TAX, STATUS2
from LEDGER
where REFNO = iRefNo
union
select 'ARCHIVE', REFNO, digits(AccNo) || AccSfx,
STATUS, GLDATE, GLSEQ, TRNTYP, GROSS, TAX, STATUS2
from ARCHIVE
where REFNO = iRefNo
end
The select statement has been tested on its own and returns the expected results. I have created the function in library QGPL and it shows as a *SRVPGM, however when I try to call the function I get the following:
select * from table(SCANLEDGER('5046839W')) X
SCANLEDGER in *LIBL type *N not found.
I have checked and QGPL is in the library list. If I qualify the function with QGPL I get the same error. The help text says to look at the joblog, but that doesn't show anything else even with debug switched on.
The syntax of the function was taken from an example in the IBM Info Centre and modified to fit.
Am I missing something obvious here?
Thanks
Jonathan
________________________________
Proud partner of The Ageas Bowl and the Ageas Salisbury International Arts Festival.
Registered Address: Ageas House Tollgate Eastleigh Hampshire SO53 3YA Registered Number: 354568 England
Authorised and regulated by the Financial Services Authority
This e-mail together with any attachments are intended for the addressee only and may be private and confidential. If you are not the intended recipient, or the person responsible for delivering it to the intended recipient, you must not open any attachments, or copy, disclose, distribute, retain or use this e-mail, including any attachments, in any way whatsoever; please return it to us immediately using the reply facility on e-mail.
Consider the environment and think before you print this email.
As an Amazon Associate we earn from qualifying purchases.
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.