IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Logic for a program to find word count


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
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
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
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: -

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

Also check this: -
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top