Let's try it formatted:

---CVTPROTO---

     d StrToNum        pr
     d   numaddr                       *   value
     d   numtype                      1    value
     d   size                        10i 0 value
     d   numfrac                     10i 0 value
     d   string                     128    value varying

---RPGCVTEFN---

     h nomain bnddir('QC2LE')
      *
      /copy cvtproto
      *
     d SIGNED          c                   const(x'00')
     d ZONED           c                   const(x'02')
     d PACKED          c                   const(x'03')
     d UNSIGNED        c                   const(x'0A')
     d USMASK          c                   const('$,.')

     d rcvattr         ds
     d  type                          1
     d  frac                          3i 0
     d  digits                        3i 0
     d                               10i 0 inz(0)

     d cvtefn          pr                  extproc('_CVTEFN1')
     d  receiver                       *   value
     d  rcvattr                       7    const
     d  source                         *   value
     d  length                       10i 0 const
     d  mask                          3    const

     p StrToNum        b                   export
     d StrToNum        pi
     d   numaddr                       *   value
     d   numtype                      1    value
     d   size                        10i 0 value
     d   numfrac                     10i 0 value
     d   string                     128    value varying
     c                   select
     c                   when      numtype = 'P'
     c                   eval      type = PACKED
     c                   eval      digits = size
     c                   eval      frac = numfrac
     c                   when      numtype = 'S'
     c                   eval      type = ZONED
     c                   eval      digits = size
     c                   eval      frac = numfrac
     c                   when      numtype = 'B' or numtype = 'I'
     c                   eval      type = SIGNED
     c                   eval      digits = size
     c                   eval      frac = 0
     c                   when      numtype = 'U'
     c                   eval      type = UNSIGNED
     c                   eval      digits = size
     c                   eval      frac = 0
     c                   endsl
     c                   callp     cvtefn(numaddr:rcvattr:
     c                                    %addr(string) + 2:
     c                                    %len(string):
     c                                    USMASK)
     p StrToNum        e


YAHOO! GROUPS LINKS




Reply via email to