|
-----Original Message-----On
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
Behalf Of Rory Hewitt'greater-than-limit'
Sent: Thursday, January 29, 2009 1:59 PM
To: RPG programming on the IBM i / System i
Subject: Re: FOR loop limit
Alan,
Certainly it's a better idea to use an integer in terms of performance and
the the OP wouldn't have hit *this* problem (overflowing at 1000), but if
he'd specified, for instance, a 3I field, he'd have hit a problem at 128,
since a 3I field can only store up to 127. Or at 32768 for a 5I field.
The underlying problem is that the FOR loop checks for
rather than 'equal-to-limit' - in other words, your index has to be ableto
take a value 1 greater than the limit.list
Rory
On Thu, Jan 29, 2009 at 10:37 AM, Alan Campin <alan0307d@xxxxxxxxx> wrote:
The solution is simple. Don't use packed decimal for loop index. Many,--
many times slower. Always, always use integers. The compiler is
working correctly.
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
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.