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 for a string and its occurence

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

New User


Joined: 30 Jan 2006
Posts: 10
Location: Chennai

PostPosted: Fri Feb 24, 2006 3:23 pm    Post subject: Search for a string and its occurence
Reply with quote

icon_biggrin.gif Hi,

could someone please let me know which command or syntax must I use to get the no. of occurence of a particular string within a file.
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Fri Feb 24, 2006 5:03 pm    Post subject:
Reply with quote

If you want a single string within a dataset or member:

- When you in edit macro, you can use the FIND_COUNTS statement, as described in the fine manual.

- For pure REXX, you'll have to read the dataset line by line, and look for your string at each line. There is no function to find a string in a whole file in the REXX language.

O.
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Fri Feb 24, 2006 6:42 pm    Post subject:
Reply with quote

Hey iwannaknow,
When u want to look for an occurance of a particular string in a DS, u can use the ISPF-ED macro "FIND".
The syntax is -
"FIND <search_str>"
"cursor = (cr cc)"
"line = line .zcsr"
say line
say cr
Back to top
View user's profile Send private message
iwannaknow

New User


Joined: 30 Jan 2006
Posts: 10
Location: Chennai

PostPosted: Fri Feb 24, 2006 7:05 pm    Post subject: Need more...
Reply with quote

amitava wrote:
Hey iwannaknow,
When u want to look for an occurance of a particular string in a DS, u can use the ISPF-ED macro "FIND".
The syntax is -
"FIND <search_str>"
"cursor = (cr cc)"
"line = line .zcsr"
say line
say cr


can u please explain me in deatail 'coz I'm new to REXX.
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Mon Feb 27, 2006 10:00 am    Post subject:
Reply with quote

Look Iwannaknow,
What I have posted is just simple REXX macro. So for that u should include on the top the following lines -
address ispexec "control errors return"
address ispexec
address isredit
After these lines, u have to give the codes mentioned above. By
address ispexec "control errors return" - this will assure ur REXX routine or macro not to display any errors raised by the system.
address ispexec - Invokes the ispexec environment
address isredit - Invokes the isredit environment. Needed for reading a DS by macro.
Then I searched by ispf-edit macro "FIND". Then I found out the cursor position. The row will come in cr & the column will come in cc varaibles. Then the current line in which the cursor is placed, I put it in line variable.
For more details, plz refer any REXX documnet already posted in this forum.
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Wed Mar 01, 2006 7:21 pm    Post subject:
Reply with quote

Hy,

make an edit-macro --> address isredit "macro ..."
then find the strings --> isredit "find /string/ all"
then get the number of --> isredit "(var1,var2) = find_counts"

in var1 is the number of strings found in the entire dataset...

martin9
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 5 Sat Oct 14, 2017 2:29 am
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

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