IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Search a character multiple times in a line


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
siva102

New User


Joined: 28 Nov 2007
Posts: 63
Location: Chennai

PostPosted: Mon Jan 31, 2011 7:49 pm
Reply with quote

Hi,

I need a help on searching a string.

The i/p File is : -

Code:

----+----1----+----2----+----3----+----4----+----5----+----6
123bn 1234nh1234 534568nvkxc8945ynm,k
2345nilm,bf94utksdnhf
gh237i%hawd
khughygygf%asjbamdbh%amsjdhajkd%989898


Whenever % encounters it need to do some process.

I am using the below code for getting the character %,
Code:

 do k = 1 to readin.0       
    if pos("%",readin.k) > 0


But i am always able to find the first occurance of the % character in any line and the rest are getting bypassed.

Can anyone please let me know to get the next occurance of the character % in the same line.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Mon Jan 31, 2011 8:29 pm
Reply with quote

Whenever you find the percent sign, you know the position and can break up the variable into smaller parts. And use the POS again on the remainder.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jan 31, 2011 8:48 pm
Reply with quote

you could also consider using the START parameter of the POS command which is exactly what you need.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top