|
Why not roll your own decimal function: D MyDec PR 7P 2 D Char 7A Const /Free CDSRTL = MyDec(PASSSUGRTL); /End-Free P MyDec B D MyDec PI 7P 2 D Char 7A Const /Free Return %Dec(Char)/100; /End-Free P MyDec E Paul Paul Morgan Senior Programmer Analyst - Retail J. Jill Group 100 Birch Pond Drive, PO Box 2009 Tilton, NH 03276-2009 Phone: (603) 266-2117 Fax: (603) 266-2333 "Tyler, Matt" <mattt@xxxxxxxxxxxxxx> wrote in message news:E93417D2BB84D94A8497F8E22DF19967216914@xxxxxxxxxxx > 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-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.