|
Hi,
so you want to write an invoice, where the quantities, prices and totals
look as follows:
Quantity Price Total
100 1.23 123
1 2.5 2.5
2.25 2.25 5.0625
1 10 10
-----------
= 140.5625
I don't believe so!
You'd rather like to see:
Quantity Price Total
100.000 1.23 123.00
1.000 2.50 2.50
2.250 2.25 5.06
1.000 10.00 10.00
-----------
= 140.56
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 23:14
An: RPG programming on the AS400 / iSeries
Betreff: Re: AW: Help on %EDITC
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
>>
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
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.