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



Ok SQL gurus,



What am I doing wrong?



I looked at Alan Campin's IDate routines as a basis for one I am trying
to write. Here is the SQL Statement I used to create the function.



create function iDate (numeric, numeric, numeric, numeric)

returns Date language RPGLE

external name 'MIQLIBP/MIQUTIL(IDATE)'

deterministic no SQL Parameter Style SQL Allow Parallel

No External Action

Function IDATE was created in QGPL.





Here is the prototype for the procedure within my service program.



P iDate B Export

D iDate PI

D pCC 2S 0

D pYY 2s 0

D pMM 2s 0

D pDD 2s 0

d pOutDate like(StdDate)

d InDataNull...

d Like(StdIntSml)

d OutNull...

d Like(StdIntSml)

d OutSQLState...

d Like(StdSQLState)

d InFunctionName...

d 139a Varying

d InSpecificName...

d 128a Varying

d OutDiagnosticMessage...

d 70a Varying



d ds

d wDate 8s 0

d wCC 2s 0 overlay(wDate: 1)

d wYY 2s 0 overlay(wDate: 3)

d wMM 2s 0 overlay(wDate: 5)

d wDD 2s 0 overlay(wDate: 7)



/FREE



Clear wDate;

wCC = pCC;

wYY = pYY;

wMM = pMM;

wDD = pDD;



test(de) wDate;

If %error;

OutNull = -1;

OutDiagnosticMessage = *Blank;

Else;

poutDate = %Date(wDate);

ENDIF;



OutSqlState = cSqlStateOk;





Now I can get it to work fine from RPGLE to RPGLE, but when I try to use
it within Sql it fails.



All I get is:



User-defined function error on member ARMAST.



I am simply trying to get started before finishing off the code.



TIA,





Sharon Wintermute




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.