Here is a general purpose conversion routine.
The prototype is:
---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
The program is:
---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 Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/2jUsvC/tzNLAA/TtwFAA/wbFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Easy400Group/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/