× 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.



Joel Fritz wrote:
> 
> There are a couple of things to watch for with atoi().  It's limited to the
> size of an integer and returns zero when it sees zero or an error.  You
> should use it only when you're already sure you have valid numeric
> characters and won't cause overflow.  atol() handles larger numbers--long
> integers, but has the same error handling.
> 

Actually, on the iSeries, atol() and atoi() both return a 4-byte
integer.  atoll (long-long) returns an 8 byte integer (RPG 20i) and is a
better choice for a general-purpose routine.

On V5R2, look at %int, %inth, %uns, %unsh, %dec, %dech, and %float for
converting character to numeric.  These builtins give an error for
invalid data or overflow (they allow (and ignore) blanks anywhere in the
data, and all except %float allow either leading or trailing signs).


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.