Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Search a character multiple times in a line

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
siva102

New User


Joined: 28 Nov 2007
Posts: 64
Location: Chennai

PostPosted: Mon Jan 31, 2011 7:49 pm    Post subject: Search a character multiple times in a line
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

Senior Member


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

PostPosted: Mon Jan 31, 2011 8:29 pm    Post subject: Reply to: Search a character multiple times in a line
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: 6968
Location: porcelain throne

PostPosted: Mon Jan 31, 2011 8:48 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 3 Sat Oct 14, 2017 2:29 am
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us