Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 287
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
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm
No new posts Which function does the Ampersand (&a... Andi1982 PL/I & Assembler 3 Wed Aug 24, 2016 2:05 pm
No new posts Need a help how to replace a string i... gurunath82 CLIST & REXX 12 Tue Jul 26, 2016 11:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us