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

How to count the appearance of a char?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Lord.of.Wind

New User


Joined: 17 Nov 2005
Posts: 60

PostPosted: Mon Sep 11, 2006 9:20 am
Reply with quote

Dear all:

Could you tell me how to how to count the appearance of a char, besides copying it into an array and count the apperance in a loop?

For instance,
How to count the appearance of 'm' in 'ibmmainframes.com' --- how many 'm's in 'ibmmainframes.com'?

Thank you!
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Mon Sep 11, 2006 9:50 am
Reply with quote

Quote:
How to count the appearance of 'm' in 'ibmmainframes.com' --- how many 'm's in 'ibmmainframes.com'?


Code:
WS-STRING      PIC X(30) Value 'ibmmainframes.com'.
WS-CNTR      PIC X(99) Value ZEROES.

INSPECT WS-STRING TALLYING WS-CNTR FOR "m"
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
Search our Forums:

Back to Top