| 
 | 
>The biggest hurdle, which I have not solved
>yet, is the handling of displaying digits
>(grin) , there's no SQL in-built function
>that could convert it to a string  but with
>the appropriate editing
(appropriate meaning "no editing.")
Look into writing your own SQL function.  Here's a simple RPG version for
you to play with.  Look into the edit APIs for a more generic solution.  The
point of this code is to demonstrate how to write and register your own UDF
(User Defined Function).
Source member QRPGLESRC SQLNOEDIT
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
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
(register the function by copy/pasting the above comments)
select total,noedit(total) from master
....+....1....+....2....+....3....+....4....+....5
     ACC/REC   NOEDIT ( TOTAL )
     TOTAL
        5.00   000000000000005000000000000000
         .00   000000000000000000000000000000
Buck
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.