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
 

 

Logic for a program to find word count

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
sreddy

New User


Joined: 16 Mar 2005
Posts: 8
Location: Bangalore

PostPosted: Thu Apr 13, 2006 3:39 pm    Post subject: Logic for a program to find word count
Reply with quote

Hi



Can any one suggest the logic for a program to find word count,

EX:

Text is : we are mainframe guys
output No words: 4
Back to top
View user's profile Send private message

Piyu

New User


Joined: 12 Apr 2006
Posts: 3
Location: Washington DC

PostPosted: Thu Apr 13, 2006 9:13 pm    Post subject: Re: Logic for a program to find word count
Reply with quote

I think assuming you know the max number of words you can receive, you can use the UNSTRING using space as DELIMITER with the TALLYING option. Check this link: -

http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.aix.cbl.doc/tpstr06e.htm

Also check this: -
http://www.uni.edu/coboldoc/cobrm_035.htm. Find word UNSTRING here.
Back to top
View user's profile Send private message
acp_ajay1

New User


Joined: 13 Mar 2006
Posts: 9

PostPosted: Tue Apr 18, 2006 11:25 am    Post subject: Re: Logic for a program to find word count
Reply with quote

Hi sreddy,

U can also take a variable of type char of length 1 and extract one by one all the characters of the string and check whether the character is space or not. Since u know the total length it should not be a problem for u.

This method is ok if u just want to count the number of words but if u want to store them separately then i suggest u go for the unstring method.

Hope this was helpful.

Regards,
Ajay
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 -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm


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