|
To All, Thanks for the help The "Can it be Cleaned up" in the subject referred to the number of emails that had nothing to do with the archived "Character to Numeric" subject already found while searching for info. As far as a solutions I knew about "atoll and atoi functions" but was mainly going for "can I do this on v5r1">>> Eval CHAR1 = %editc((%dec(CHAR1) + NUM1):'4') . I jump around so much RPGII RPGIII RPGIV on diff. versions / releases I could not remember how it handled %dec on v5r1. It looks like I just caused more junk to get in archive. Sorry but thanks for all the answers given from everyone. Thanks Bill Hopkins This was my original post. I just went through this subject in the archive. After a hour or so of reading the "Brad S. and Hans B." show. About searching for stuff on the web and what wrong with your code battle. PS. can all those emails that had nothing to do with subject be deleted? Also had tried to get to the discontinued "snippets" page. At least by the URL's posted. I was wondering if can I do this on v5r1 or am I stuck with 'C' functions and procedures (that do 50 times more than I need on this). Eval CHAR1 = %editc((%dec(CHAR1) + NUM1):'4') Just wanted to add a number to a character field with a number in it and no decimals in it's value. Result in character. Any suggestions "Bob cozzi" <cozzi@xxxxxxxxx> Sent by: rpg400-l-bounces+bhopkins=libertyhardware.com@xxxxxxxxxxxx 08/18/2003 10:11 AM Please respond to RPG programming on the AS400 / iSeries To: "'RPG programming on the AS400 / iSeries'" <rpg400-l@xxxxxxxxxxxx> cc: Subject: RE: Character to Numeric can it be cleaned up Actually, the ATOLL and ATOI functions (in lower case) have been posted to this list a million times, so check the archives if that's all you need is simply '1234' to X'01234F' functionatlity. Bob Cozzi Cozzi Consulting www.rpgiv.com -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Christen, Duane J. Sent: Monday, August 18, 2003 7:55 AM To: 'RPG programming on the AS400 / iSeries' Subject: RE: Character to Numeric can it be cleaned up For you cheapos out there, like me, the C library has several conversion functions/APIs. They may not be quite as easy to use as APIs created for RPG IV but they are portable to other iSeries no mater the version. The C library is on every iSeries/AS-400 weather or not you have compiler, as long as you have another ILE compiler (RPG, COBOL), you can use these functions. Duane -----Original Message----- From: Bob cozzi [mailto:cozzi@xxxxxxxxx] Sent: Saturday, August 16, 2003 11:18 AM To: 'RPG programming on the AS400 / iSeries' Subject: RE: Character to Numeric can it be cleaned up You do NOT have to use MOVE to get a character value into a numeric field or vis versa. My RPG ToolKit (www.rpgiv.com/toolkit) uses an MI instruction to provide the CharToNum() function that works at V4R4 and alter levels. There are also a few other routines posted on the web to do the same thing (including one that I wrote). IBM can't do everything at once (although I wish they would <g>)) so you may either (A) have to create your own routines or (B) buy a 3rd party add-on library for RPG. So I don't see a problem here. Bob Cozzi Cozzi Consulting www.rpgiv.com -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Carel Teijgeler Sent: Saturday, August 16, 2003 10:54 AM To: rpg400-l@xxxxxxxxxxxx Subject: Re: Character to Numeric can it be cleaned up Hans, I know that. But I think the work was half done, as those BIFs only worked with values known at compile time (literals, constants) and not with values from fields in database files. So a statement like "Eval MyNumber = %DEC(MyCharacterField)" will not compile on V5R1 and older OS releases. This can be done at V5R2 (I hope). To get a numeric value in a character field into a numeric field you have to use MOVE. At V5R1 with /free at my disposal. (Joe Pluta's arguments are still standing!) So, I still consider those BIFs useless at those OS levels. I would have been better, if IBM had not introduced them at that time. Regards, Carel Teijgeler *********** REPLY SEPARATOR *********** On 16-8-03 at 9:37 Hans Boldt wrote: >> Unfortunately, %DEC is not fully matured on V5R1 and only accept values >> known at compilte time (read: hard coded values). This BIF is therefore rather useless at this OS level. >> >> And to think of it: this BIF (and its cousins) were developed to dump MOVE in /free. (sic!) > >Sorry for the nitpicking, but %DEC, %INT, %UNS, etc. were added to the language several releases before /FREE. _______________________________________________ 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. _______________________________________________ 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. NOTICE: This electronic mail transmission may contain confidential information and is intended only for the person(s) named. Any use, copying or disclosure by any other person is strictly prohibited. If you have received this transmission in error, please notify the sender via e-mail. _______________________________________________ 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. _______________________________________________ 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.