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



Yes,
%INT() will blow up if the string is empty/blank.
atoi() will return zero.

I prefer atoll() for longer values and tend to use it exclusively (instead of
atoi()).

%INT() accept strings with embedded blanks, such as "1 2 3", and return 123.
atoi() will not return 123.

%DEC and atoi() are not really a fair comparison. One does packed decimal
output, the other does integers which can be easily copied to packed decimal.

%DEC() uses hard-coded length and decimal positions.
atoi() doesn't use a length. 
-Bob Cozzi
www.i5PodCast.com
Ask your manager to watch i5 TV



-----Original Message-----
From: rpg400-l-bounces+bob=rpgworld.com@xxxxxxxxxxxx
[mailto:rpg400-l-bounces+bob=rpgworld.com@xxxxxxxxxxxx] On Behalf Of Johan
Vangilbergen
Sent: Thursday, February 08, 2007 1:43 PM
To: RPG programming on the AS400 / iSeries
Subject: Using %Dec and %Int instead of atoi

Hi list,

 

Until yesterday, we still had 1 client under V5R1M0.  Finally he moved
to V5R3M0, so now we don't have to compile our programs to target
release V5R1M0.

 

Until now, we used the C-function "atoi" to convert character fields to
numeric, because %Int and %Dec couldn't be used for V5R1M0.

Are there any disadvantages (or benefits) in the use of %Int and %Dec
instead of atoi ?

 

 

 

 

Johan Vangilbergen

 

YUSE

Phone : +32 16 74 50 80

Fax : +32 16 74 50 89

Email : jvg@xxxxxxx <mailto:jvg@xxxxxxx> 

Web : WWW.Yuse.be <http://www.Yuse.be> 

Address : Bondgenotenlaan 138, B-3000 Leuven, Belgium

 


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.