|
I've created some SQL user defined functions (UDF) that I am using in my embedded SQLRPGLE programs. I am having a problem that the UDF will not use my *LIBL. In my regular embedded SQL I do not need to specify the library that contains the file; It uses my LIBL. The function however is forcing me to HARDCODE the library in order to work correctly. Anybody know what I'm doing wrong? Below is the code fro the function and the SQLRPGLE program at V5R2: CREATE FUNCTION GETCEN (pYear Decimal (2,0)) Returns Decimal(2,0) Language SQL Reads SQL Data Deterministic Returns Null On Null Input Begin Declare wCenturyBaseYear Decimal(2,0); Declare wLowCentury Decimal(2,0); Declare wHighCentury Decimal(2,0); Declare pCentury Decimal(2,0); Set Path = *LIBL; Select SYBSYR, SYLCEN, SYHCEN Into wCenturyBaseYear, wLowCentury, wHighCentury From MYFILE Where SYCO = 01 and SYID = ' '; If wCenturyBaseYear IS NULL Then Set wCenturyBaseYear = 85; Set wLowCentury = 19; Set wHighCentury = 20; End If; If pYear > wCenturyBaseYear Then Set pCentury = wLowCentury; Else Set pCentury = wHighCentury; End If; Return pCentury; End -- GETCEN; Below gives me an error at runtime that "MYFILE in MYLIB(which is my CURLIB) type *FILE not found" even though MYFILE is in my LIBL. * C/EXEC SQL C+ SET :@CENT = GETCEN(:@YEAR) C/END-EXEC * David Smith IT Consultant dsmith@xxxxxxxxx 517.546.5400
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.