× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Because a field with 5 decimal places can have more than 2 digits different from zero, as a general rule. Normally you don't write the zeros to the right after the decimal point, unless you want to specify a high precision.
_________________________________________________________________________________________
HauserSSS wrote:

Hi,

why not simply use the BIFs %DEC or %DECH to format your numeric values,
before %EditC?

MyAlpha = %EditC(%DecH(MyNum: 7: 2): 'A');

Birgitta

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von Raul A. Jager W.
Gesendet: Montag, 25. Juli 2005 16:08
An: RPG programming on the AS400 / iSeries
Betreff: Re: Help on %EDITC


I don't think you can do it with editc one way to do it is with %char;
but it will not separate the thousands.

If tou need the output aligned by the decimal point you can put the
edited field in a work area and replace the trailing zeros by blanks,
something like this:
asuming an edited output of 20 characters, adjust as needed.

aux20 = %editc(number:..
for i = 20 to 1 by -1;
  if %subst(aux20: i: 1) <> *zero;
      leave;
  endif;
  %subst(aux20: i: 1) = *blank;
endfor;

If you don't care about align:

edited= %xlate(' ': '0': %trim(%xlate('0': ' ': %editc(number: 'a')));
____________________________________________________________________________
____
Dwarakanath, Srikanth (Cognizant) wrote:

Thanks Jim,

Resending my request.....

I have a requirement not to print trailing zeros in decimal fields.
I had a look at all the %EDIT options in RPG's built in function, could not
figure it out by my self.
For e.g.

123.5600000 should be printed as 123.56.

Can I get some help please.

Many thanks for help.

Best rgds.,
Srikanth D




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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.