× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Char to numeric conversion question
  • From: "David Morris" <dmorris@xxxxxxxxxxxxx>
  • Date: Tue, 20 Apr 1999 09:30:41 -0600

All,

Midrange Computing published just such a routine in April of 1998.  It 
is available on their web site and was written by John Thompson.  I 
use a slightly modified version that returns a 30.9 result.  The published 
version handled values up to 25.9.  I use this with a utility procedure 
I wrote based on information posted on Midrange Computing's RPG 
and ILE programming forums by Barbara Morris and Bruce Vining.  
They described how to use the Late Bound Copy Numeric Value APIs.  
I suspect they have/will publish this as a technical tip.  I will forward my 
code to interested parties.

David Morris

>>> <boldt@ca.ibm.com> 04/20/99 06:12AM >>>
...As others have suggested, probably the best way is to
search for the decimal point, put the portions of the
string to the left and right of the decimal point into
a character subfield that overlays a zoned numeric
subfield, xlate blanks to zeros, and there you have the
value.  You'll need a bit of extra code to handle possible
leading negative sign as well as to scale the number
depending on the position of the decimal point.  The
important thing is to code this into a procedure.  Finally, 
once you have a robust procedure coded, why not make it
public so that others can benefit?

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com 

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.