|
Here's another way (untested of course): 0464.00 * replace trailing blanks in amtA with leading zeros 0465.00 c eval amtA = %trim(amtA) 0466.00 c eval x = %scan(' ':amtA) 0467.00 c if x > 1 0468.00 c eval amtA = %subst('000000000000':1:13-x) 0469.00 c + %subst(amtA:1:x-1) 0470.00 c else 0471.00 c eval amtA = '0000000000.00' 0472.00 c endif Colin Thorpe <Colin@IBS-PUBLIC-SERVICES.CO.UK> Sent by: owner-rpg400-l@midrange.com 08/17/00 10:11 AM Please respond to RPG400-L To: RPG400-L@midrange.com cc: Subject: Character to Decimal Hi all, I am trying to take a character field (10A) containing something like 123.45bbbbb, And move it into a numeric field (12,2) 0000000123.45. The character field may or may not contain a decimal point. Therefore its value could be from .01 ==> 9999999999 Some time ago the C function ATOL was mentioned by Hans. I'm using V3R7 and managed to get his example working fine. Unfortunately this only returns the integer part of the value. I also tried ATOF but I'm not sure what the resulting value means. 2235.14 = 1079246848 ? I can solve this problem using data structures and selects but I'm looking for an elegant ILE solution. Any help will be greatly appreciated. Thanks in advance Colin +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.