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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Need help in building a logic Benchwarmer All Other Mainframe Topics 4 Wed Feb 22, 2017 2:49 am
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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