|
>Somewhere I heard about user-defined functions. I was wondering if >somebody has some instructions on programming (rpg)/registering/using >them. That's if it is possible to do it with qmquery.... Hi Matthias! Yes, we can do UDF's with QMQRY; no problem. I have a very simple example that might get you started. It returns a numeric value without any editing. h debug dftactgrp(*no) actgrp(*caller) * dbgview(*list) * Return a numeric value without editing * register: * CREATE FUNCTION NOEDIT (DECIMAL(30,15)) * RETURNS VARCHAR(256) * RETURNS NULL ON NULL INPUT * LANGUAGE RPGLE * EXTERNAL NAME 'BUCK/SQLNOEDIT' * DETERMINISTIC * NO SQL * NO EXTERNAL ACTION * PARAMETER STYLE SQL * DISALLOW PARALLEL * execute by: * select noedit(total) from master d inpDec s 30 15 d outChar s 256 varying d inpInd s 5i 0 d outInd s 5i 0 d outSQLState s 5 d inpFuncName s 139 varying d inpSpecName s 128 varying d outDiagTxt s 70 varying c *entry plist c parm inpDec c parm outChar c parm inpInd c parm outInd c parm outSQLState c parm inpFuncName c parm inpSpecName c parm outDiagTxt c eval outChar = %editc(inpDec: 'X') c eval *inlr = *on As for reference material, visit http://publib.boulder.ibm.com/html/as400/v5r1/ic2924/info/rzahf/rzahfms1.htm and choose one of the UDF examples from the "examples" box. --buck
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.