|
> Hans said:
>
> >Well, if %EDITW does what you want, then
> >why not just use that?
> >
> >But if you want to avoid %EDITW, then
> >you can always try:
> >%xlate(' ':'0':%editc(num:'3'))
>
> Which requires a V5 OS/400 release. The request didn't mention them, but
> %xlate doesn't handle negative numbers. If, for instance the input number
> was -12.34, you would probably use the L edit code, which would result in
> 00012.34- If you use an L edit code on a positive number like 12.34 you
> would get 00012.340, because of the trailing space where the sign would go.
> Of course you could wrap that up in a test and use edit code 3 for positive
> numbers and L for negative numbers, but why go through that?
>
> Hans' comment about %editw makes sense to me.
> --buck
We are on V5R1 and this particular case is by rule a positive number so it
works; however, this is not always the case. Usually
(not always) when we have a field that could be negative, they have a separate
field for the sign (-,+). The test for negative to
determine the sign field and then
%xlate(' ':'0':%editc(%abs(num):'3')) should handle that. It's definitely food
for thought.
Thanks,
Seth Shields
Julius Blum, Inc.
7733 Old Plank Rd.
Stanley, NC 28164
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.