× 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.



Dear Srikanth,

I still feel there is some problem with requirement. Can you tell me how do
you want to display the following values.

120.000 
100.000

if the output expected is this120,100. Then, I hope this might help you.  As
you have previously said that you want to move to a Character Field the code
is designed in that way. Please try the following code the test.

d numvar1         s              9p 6 
d chrvar             s             10a                             
c     numvar1       dsply                                       
c                          eval      chrvar = %trim(%char(numvar1):'0')
c     chrvar           dsply                                       
c                          eval      *inlr = *on                       


Thanks and Regards,
Sriram Srinivasan


 -----Original Message-----
From:   rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Raul A. Jager W.
Sent:   Tuesday, July 26, 2005 2:44 AM
To:     RPG programming on the AS400 / iSeries
Subject:        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
>>



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.