|
This is a multipart message in MIME format. -- [ Picked text/plain from multipart/alternative ] You're right on here buddy. '19049 ' is not the same as char10. SQL UDF's are extremely sensitive to overloading. CREATE TABLE ROB/ALEXEI (FLD1 CHAR (8 ) NOT NULL WITH DEFAULT, FLD2 CHAR (10 ) NOT NULL WITH DEFAULT) INSERT INTO ROB/ALEXEI VALUES('V01.073', '19049 ') select FLD1, FLD2, VALIDTPNBR(FLD1,FLD2) from ROB/ALEXEI Doesn't get the same error. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Alexei Pytel" <pytel@us.ibm.com> Sent by: rpg400-l-admin@midrange.com 04/26/2002 04:00 PM Please respond to rpg400-l To: rpg400-l@midrange.com cc: Fax to: Subject: Re: UDF: SQL0204-VALIDTPNBR in *LIBL type *N not found. there is another thought... UDFs are pretty specific about parameter types. If you declared function as (CHAR (8), CHAR (10)), you got to be sure that you call it with exactly these types of parameters. Try to cast parameters explicitly to CHAR(8) and CHAR(10) respectively. Alexei Pytel this is just a personal opinion rob@dekko.com Sent by: To: rpg400-l@midrange.com rpg400-l-admin@mi cc: drange.com Subject: Re: UDF: SQL0204-VALIDTPNBR in *LIBL type *N not found. 04/26/2002 03:52 PM Please respond to rpg400-l This is a multipart message in MIME format. -- [ Picked text/plain from multipart/alternative ] Thank you but that resulted in SQL0206-Column WEB not in specified tables. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Alexei Pytel" <pytel@us.ibm.com> Sent by: rpg400-l-admin@midrange.com 04/26/2002 03:41 PM Please respond to rpg400-l To: rpg400-l@midrange.com cc: Fax to: Subject: Re: UDF: SQL0204-VALIDTPNBR in *LIBL type *N not found. I think you should qualify a call to UDF: select tpttype, tpt400, tptlib, tptfile, tptfield, web/VALIDTPNBR(tpttype,'19049 ') from web/tptype Alexei Pytel speaking for myself rob@dekko.com Sent by: To: rpg400-l@midrange.com rpg400-l-admin@mi cc: drange.com Subject: UDF: SQL0204-VALIDTPNBR in *LIBL type *N not found. 04/26/2002 03:31 PM Please respond to rpg400-l This is a multipart message in MIME format. -- [ Picked text/plain from multipart/alternative ] I've created a UDF, or User Defined Function, with the following: P*-------------------------------------- P* Procedure name: VALIDTPNBR P* Purpose: Validates Trading partner number P* Returns: '1'=Yes the tp number is valid, '0'=No it is not P* Parameter: tpttype => Trading partner type P* Parameter: tpnbr => Trading partner number P*-------------------------------------- P VALIDTPNBR B EXPORT D VALIDTPNBR PI N D tpttype LIKE(tpnbr.tpttype) CONST D tpnbr LIKE(tpnbr.tpnbr) CONST D* Local fields D rValidTpNbr S N D wTpName s 100a /free wTpName=RtvTpData(tpttype:tpnbr:'TPTPNAME'); Select; When wTpName=*loval or wTpName=*blanks or wTpName='*NONE'; rValidTpNbr=*off; Other; rValidTpNbr=*on; EndSl; return rValidTpNbr; /end-free P VALIDTPNBR E create function WEB/VALIDTPNBR (CHAR (8), CHAR (10)) returns CHAR (1) simple call language rpgle deterministic reads sql data returns null on null input no external action allow parallel external name 'WEB/WEBSRV(VALIDTPNBR)'; This select tpttype, tpt400, tptlib, tptfile, tptfield from web/tptype results in: Trading AS/400 Library File Field Partner Partner Partner Partner Type Type Type Nbr V01.073 GDISYS DATDIVF AVM VENDOR This: select tpttype, tpt400, tptlib, tptfile, tptfield, VALIDTPNBR(tpttype,'19049 ') from web/tptype Results in: Additional Message Information Message ID . . . . . . : SQL0204 Severity . . . . . . . : 30 Message type . . . . . : Diagnostic Message . . . . : VALIDTPNBR in *LIBL type *N not found. Cause . . . . . : VALIDTPNBR in *LIBL type *N was not found. If this is an ALTER TABLE statement and the type is *N, a constraint was not found. If this is not an ALTER TABLE statement and the type is *N, a function, procedure, or trigger was not found. Recovery . . . : Change the name and try the request again. If the object is a node group, ensure that the DB2 Multisystem product is installed on your system and create a nodegroup with the CRTNODGRP CL command. QSYS2/SYSFUNCS has: SPECIFIC_SCHEMA SPECIFIC_NAME ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_CREATED ROUTINE_DEFINER ROUTINE_BODY QDIRSRV QGLDRSDX QDIRSRV QGLDRSDX 2001-03-10-08.21.26.962000 QDIRSRV EXTERNAL ROB3 ONHAND ROB3 ONHAND 2001-11-30-08.02.52.040000 ROB EXTERNAL ROUTINES FAXA ROUTINES FAXA 2002-02-13-08.41.04.050000 ROB EXTERNAL ROUTINES FAXN ROUTINES FAXN 2002-02-13-08.41.04.695000 ROB EXTERNAL ROUTINES FAXAREACODE ROUTINES FAXAREACODE 2002-02-13-08.41.04.796000 ROB EXTERNAL ROUTINES FAXEXCHANGE ROUTINES FAXEXCHANGE 2002-02-13-08.41.04.884000 ROB EXTERNAL ROUTINES FAXNUMBER ROUTINES FAXNUMBER 2002-02-13-08.41.05.021000 ROB EXTERNAL ROUTINES FAXNEWAREA ROUTINES FAXNEWAREA 2002-02-13-08.41.05.127000 ROB EXTERNAL ROB ONHAND ROB ONHAND 2002-02-13-10.16.20.950000 ROB EXTERNAL ROUTINES FAXNEWPHONEA ROUTINES FAXNEWPHONEA 2002-02-14-10.57.21.240000 ROB EXTERNAL ROUTINES FAXNEWSTRING ROUTINES FAXNEWSTRING 2002-02-14-10.59.46.287000 ROB EXTERNAL ROUTINES FAXNEWPHONEN ROUTINES FAXNEWPHONEN 2002-02-14-13.54.38.057000 ROB EXTERNAL WEB VALIDTPNBR WEB VALIDTPNBR 2002-04-26-15.21.50.249000 ROB EXTERNAL EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS QSYS/QGLDRSDX C SQL YES NONE ROB3/INVENTORY(ONHAND) RPGLE GENERAL YES NONE ROUTINES/SRVPGM(FAXA) RPGLE GENERAL YES NONE ROUTINES/SRVPGM(FAXN) RPGLE GENERAL YES NONE ROUTINES/SRVPGM(FAXAREACODE) RPGLE GENERAL YES NONE ROUTINES/SRVPGM(FAXEXCHANGE) RPGLE GENERAL YES NONE ROUTINES/SRVPGM(FAXNUMBER) RPGLE GENERAL YES NONE ROUTINES/SRVPGM(FAXNEWAREA) RPGLE GENERAL YES READS ROB/ONHAND(ONHAND) RPGLE GENERAL YES NONE ROUTINES/SRVPGM(FAXNEWPHONEA) RPGLE GENERAL YES NONE ROUTINES/SRVPGM(FAXNEWSTRING) RPGLE GENERAL YES NONE ROUTINES/SRVPGM(FAXNEWPHONEN) RPGLE GENERAL YES NONE WEB/WEBSRV(VALIDTPNBR) RPGLE GENERAL YES READS Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.