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
 
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 column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Command to find TMEMBER name for a TPIPE Siva NKK Kothamasu IMS DB/DC 0 Wed Aug 16, 2017 6:08 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm

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