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 

Cobol String functions

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


Joined: 14 Apr 2006
Posts: 87
Topics: 33

PostPosted: Fri Apr 14, 2006 5:52 am    Post subject: Cobol String functions Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Apr 14, 2006 6:05 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
jajularamesh
Beginner


Joined: 14 Apr 2006
Posts: 87
Topics: 33

PostPosted: Fri Apr 14, 2006 6:28 am    Post subject: Reply with quote

thanks a lot Kolusu
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