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
 
Counting no of words in a file using REXX

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

New User


Joined: 21 Feb 2007
Posts: 10
Location: India

PostPosted: Wed Feb 28, 2007 10:46 am    Post subject: Counting no of words in a file using REXX
Reply with quote

Hi,

I have a situation, where i have to count number of words say "Friend" in a file after issuing a " Find all" command in the command line. I want the count of no of " Friend " in the file.

Many Thanks in advance.

Zensa.
Back to top
View user's profile Send private message

manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Wed Feb 28, 2007 11:16 am    Post subject:
Reply with quote

Hi,

The below code will help u to do that

Code:

"ALLOC DA ('ur dataset name in single quotes') FI(INDD "                 
"EXECIO * DISKR INDD (STEM Y. FINIS)"       
STR1='FRIEND'                  /*ur search string here*/                 
X=0                                           
DO LIN1 = 1 TO Y.0                           
   PARSE UPPER VAR Y.LIN1 STR2               
   IF INDEX(STR2,STR1) > 0 THEN               
      X = X + 1                                     
 END                                           
SAY X                         
DROP Y.                                       
"FREE F(INDD)" 


Let me knew if u face problem.

Regards,
Mani
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Wed Feb 28, 2007 5:07 pm    Post subject: Re: Counting no of words in a file using REXX
Reply with quote

Hi,

I tried running this but received the following error.

8 +++ IF INDEX (STR2,STR1) > 0
Error running FINDSTR, line 8: Unexpected "," or ")"
***

Could you a bit ??

Thanks,
-Kapil.
Back to top
View user's profile Send private message
manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Wed Feb 28, 2007 5:14 pm    Post subject:
Reply with quote

Hi,

remove the space between STR2, STR1 and also INDEX (STR2 then it will work.

Regards,
Mani
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Thu Mar 01, 2007 11:59 am    Post subject:
Reply with quote

If you use Edit-Macro, you can use the FIND_COUNTS command.

Another method is to invoke SUPERC from within REXX, then parse OUTDD.

O.
Back to top
View user's profile Send private message
ram1424
Currently Banned

New User


Joined: 16 Apr 2008
Posts: 3
Location: chennai

PostPosted: Wed Apr 23, 2008 11:09 am    Post subject: Reply to: Counting no of words in a file using REXX
Reply with quote

HI,

Suppose the word"friend" is present twice in a sameline means,what i do?becoz the code given here is wont count that one..tell me any suggestion...

thanks.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Apr 23, 2008 11:58 am    Post subject:
Reply with quote

have you followed the link posted by Ovidius? the example use the ALL parameter.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Apr 23, 2008 11:05 pm    Post subject:
Reply with quote

acevedo wrote:
have you followed the link posted by Ovidius?
i would like to sound lil stupid ..where is the post from "Ovidius" in this thread..
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Apr 24, 2008 12:43 am    Post subject:
Reply with quote

Hi Anuj,

Look at the reply that refers to "FIND_COUNTS".

It is 3 posts before your question.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Apr 25, 2008 7:29 am    Post subject:
Reply with quote

Hi Dick,

You mean post by 'ofer71'..?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 25, 2008 7:49 am    Post subject: Reply to: Counting no of words in a file using REXX
Reply with quote

Yup.

d
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 File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 0 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

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