MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get the total count of delimiter in COBOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Meena_ramanathan
Beginner


Joined: 25 Oct 2005
Posts: 11
Topics: 7

PostPosted: Thu Nov 10, 2005 2:19 pm    Post subject: Get the total count of delimiter in COBOL Reply with quote

Hi,

I want to get the count of the number of delimiters
Eg:
abcd|abcd|abcd

In this case i want to get the count of the "|" symbol.Is there any function in cobol which can do this or is there more options in UNSTRING or in INSPECT which can give me the count.

Thanks
Meena
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Nov 10, 2005 2:32 pm    Post subject: Reply with quote

Meena_ramanathan,

It is quite simple task, all you need is an inspect statement. try this

Code:

01 WS-STRING     PIC X(30) VALUE 'ABCD|ABCD|ABCD'.
01 WS-TALLY      PIC S9(04) COMP.

PROCEDURE DIVISION.

INSPECT WS-STRING TALLYING WS-TALLY FOR ALL '|'               
                           
DISPLAY WS-TALLY.   


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Meena_ramanathan
Beginner


Joined: 25 Oct 2005
Posts: 11
Topics: 7

PostPosted: Thu Nov 10, 2005 2:42 pm    Post subject: Reply with quote

Thank U , it just worked fine
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group