| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Meena_ramanathan Beginner
 
 
 Joined: 25 Oct 2005
 Posts: 11
 Topics: 7
 
 
 | 
			
				|  Posted: Thu Nov 10, 2005 2:19 pm    Post subject: Get the total count of delimiter in COBOL |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Thu Nov 10, 2005 2:32 pm    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| Meena_ramanathan Beginner
 
 
 Joined: 25 Oct 2005
 Posts: 11
 Topics: 7
 
 
 | 
			
				|  Posted: Thu Nov 10, 2005 2:42 pm    Post subject: |   |  
				| 
 |  
				| Thank U , it just worked fine |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |