×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Tommy,
I've use CVTEFN for years in RPG xTools and now in my book "RPG TNT" the code is
featured. It will do what you want and often times "better" than %DEC and it
allows any target variable size. Of course you have to pass the return value as
a parm but it works create. 
Or you can use the wrapper I wrote, call CharToNum() which converts the input
value into a Packed(30,9) value and returns it. It can then be assigned to any
numeric value of any length--provided you don't extend that size. In V5.3, it
will support 63-digit values too. <g>


-Bob Cozzi
www.i5PodCast.com
Ask your manager to watch i5 TV



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Holden Tommy
Sent: Friday, March 30, 2007 1:27 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: 

alternative for %DEC? 

i have a issue i'm trying to resolve. basically i want to use something
similar to %DEC. unfortunately you can't use variable values for digits
& precision with %DEC. here is basically what i want to do:
Code:
                 number = %Dec(%trim(%Subst(Data:FieldDS(Ctr).InBuffer:
                          FieldDS(Ctr).Length)):
                          FieldDS(Ctr).Digits:FieldDS(Ctr).Decimals);
instead of using tons of IFs etc. is there a way to do this? unless
someone has a clever answer i'll end up using this kind of garbage:
Code:
  select;
     when FieldDS(Ctr).Decimals = 1;
        number = %Dec(%trim(%subst(data:fieldds(ctr).InBuffer:
               FieldDS(Ctr).Length)):30:1);
     when FieldDS(Ctr).Decimals = 2;
        number = %Dec(%trim(%subst(data:fieldds(ctr).InBuffer:
               FieldDS(Ctr).Length)):30:2);
which is a major pain....wonder if there is a way for the compiler team
to add this functionality???


Thanks,
Tommy Holden




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.