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



Hans, Barbara?  Is there a "right" way to use %scan in this
case for both OSs?  Should we always make sure that the
length of the scanning string plus the start position isn't
longer than the string we are scanning?

Brad

On Tue, 25 Jan 2005 13:47:11 -0600
 "Bob Cozzi" <cozzi@xxxxxxxxx> wrote:
> Brad,
> This is the expected/observed behavior on V4R5. When I
> wrote CGILIB I ran
> into similar issues with %SCAN and now use other, faster
> techniques that
> avoid %SCAN except in very simple situations.
> On V5Rx that changed things in order to implement
> MONITOR/On-Error. I have
> no evidence that %SCAN changed, but you are right, I see
> similar results on
> V5.2 as well.
> -Bob 
> 
> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
> On Behalf Of Brad Stone
> Sent: Tuesday, January 25, 2005 1:30 PM
> To: RPG programming on the AS400 / iSeries
> Subject: %scan BIF error or not?
> 
> I've encountered an error on a V4R5 machine with the
> %scan
> bif that doesn't appear to happen on V5R2 and functions
> as
> I would assume it would.
> 
> Here's the example:
> eval string = 'thisisatest'
> eval j = %scan('test':string:10)
> 
> Notice that the start position plus (10) the length of
> the
> lookup string (4) is longer than the string I am scanning
> (11) (this is where the problem seems to lie)
> 
> Now, I get the following error on V4R5:
> Length or start position is out of range for the string
> operation.
> 
> In V5R2 I simply get 0 for j and things work fine which
> is
> how I assumed it would work.  
> 
> I have made sure the starting position isn't more than
> the
> length of the string being scanned... it seems when the
> starting position plus the length of the lookup string is
> longer than the string to scan it throws this error.
> 
> Is this correct behavior, or is the behavior from V5R2
> correct?  If V5R2 is correct, is there a PTF to fix V4R5?
> -- 
> 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.
> 

Bradley V. Stone
BVS.Tools
www.bvstools.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.