| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| jajularamesh Beginner
 
 
 Joined: 14 Apr 2006
 Posts: 87
 Topics: 33
 
 
 | 
			
				|  Posted: Fri Apr 14, 2006 5:52 am    Post subject: Cobol String functions |   |  
				| 
 |  
				| if there are two strings str1 & str2 str1 length is 100
 str2 length is 5
 How to check whether str2 is present in Str1 or not.
 i dont want any logic instead i want to know wheather any string function which can handle the above problem
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Fri Apr 14, 2006 6:05 am    Post subject: |   |  
				| 
 |  
				| jajularamesh, 
 A simple inspect statement would
 
  	  | Code: |  	  | 01 STR1          PIC X(100).
 01 STR2          PIC X(5).
 01 WS-TALLY      PIC S9(04) COMP.
 
 INSPECT STR1 TALLYING WS-TALLY FOR ALL STR2
 
 | 
 
 If ws-tally is greater than 0 then you str2 is present in str1
 
 Hope this helps...
 
 Cheers
 
 Kolusu
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| jajularamesh Beginner
 
 
 Joined: 14 Apr 2006
 Posts: 87
 Topics: 33
 
 
 | 
			
				|  Posted: Fri Apr 14, 2006 6:28 am    Post subject: |   |  
				| 
 |  
				| thanks a lot Kolusu |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |