|
Have you tried %dec(field:7:2) where field = '0000128'? Chris Bougher "Tyler, Matt" <mattt@wincofoods. To: "'RPG programming on the AS400 / iSeries'" <rpg400-l@xxxxxxxxxxxx> com> cc: Sent by: Subject: Use of %DEC with unformatted character numerics rpg400-l-bounces@m idrange.com 12/02/2004 01:17 PM Please respond to RPG programming on the AS400 / iSeries I have a number in a character parameter 7a ('0000128') and I want to use %DEC() to convert that to a packed 7.2 field. However, I get 128.00 instead. The reference manual is not completely clear on the decimal point requirements for a character string numeric. "The decimal point is optional. It can be either a period or a comma." Is the decimal point optional in that it can be either a period or a comma or is it optional completely, be a period or be a comma? If %DEC() is treating my number as a whole number then I must say that I have been highly disappointed in the new features added to V5.2 for %DEC(). We often pass numeric data between programs in character fields (no comment please if you don't agree with this) and convert them back to numeric. We rarely include the decimal point since the only method to date was to use MOVE to convert it back to numeric. I would prefer to not have to do this just to use %DEC() if the decimal point is required in order for %DEC() to format the value as 1.28. /FREE CDSRTL = %DEC(%subst(PASSSUGRTL:1:5)+'.'+%subst(PASSSUGRTL:6:2):7:2); /END-FREE Thank you, Matt Tyler WinCo Foods, Inc mattt@xxxxxxxxxxxxxx -- 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-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.