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



It can also have fewer elements than the number of search char(s) in the
string you are scanning. You just have to write the code so that you fully
process the string. In otherwords you have to restart the scan from the last
position your search char(s) were found. 

D string        S       1000A           Inz('This_is_my_search_string')
D position      S         10I 0 Dim(2)  
D start S         10I 0 Inz(1)  


/Free
DoU position(%Elem(position)) = 0;

/End-Free
        '_'     Scan    string:start    position
/Free

// Do the work here.

start = position(%Element(position)) + 1;
EndDo;



Duane Christen  
                        

-----Original Message-----
From: rpg400-l-bounces+dchristen=mcleodusa.com@xxxxxxxxxxxx
[mailto:rpg400-l-bounces+dchristen=mcleodusa.com@xxxxxxxxxxxx]On Behalf
Of Terry Richardson
Sent: Thursday, April 06, 2006 8:45 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: RPG400-L Digest, Vol 5, Issue 429



I misspoke.  The array can have <more> elements than the searched string has
characters.  Just make the array larger than the longest string.  It can
have up to 32767 elements. (I'm at v5r2, that limit may be higher now)



message: 5
date: Thu, 6 Apr 2006 08:29:25 -0400
from: Michael_Schutte@xxxxxxxxxxxx
subject: Re: RPGLE pgm to parse a string



<<The number of elements in Array must equal the number of characters in
ScanString.>>

That's exactly why it was never suggested.  The string doesn't always have
the same amount of variables.

Michael Schutte
Work 614-492-7419
email  michael_schutte@xxxxxxxxxxxx



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.