Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem to handle strings

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vrakeshmbt

New User


Joined: 17 Aug 2005
Posts: 30

PostPosted: Mon Feb 13, 2006 10:41 am    Post subject: Problem to handle strings
Reply with quote

Hi All,

I have a variable of size X(200). Say in this variable i will write a sentence. Now if i want to search for a particular word, How can i implement it? Can anyone plz let me know the solution ASAP.
Back to top
View user's profile Send private message

balajiofcrrcoe

New User


Joined: 07 Jul 2005
Posts: 41
Location: chennai

PostPosted: Mon Feb 13, 2006 12:01 pm    Post subject: Re: Problem to handle strings
Reply with quote

Hi,

I Think you can use the inspect stmt to check for the characters and tally them
,after that print for the tally identifier if more than 1 means the string has been found.


Regards,
Naga samba siva rao varanasi.
Back to top
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Mon Feb 13, 2006 1:00 pm    Post subject: Re: Problem to handle strings
Reply with quote

Hi
Please go through the logic given below.

INSPECT FUNCTION REVERSE(TEXT1) TALLYING
L FOR LEADING SPACE

compute l = length of text1 - l
INSPECT FUNCTION REVERSE(TEXT2) TALLYING
x FOR LEADING SPACE

compute x = length of text2 - X

perform until m > l
if text1(micon_mad.gif)= text2
add 1 to no-oc
end-if
add 1 to m
end-perform.

Where text2 is searching in text1 and no-oc is no of occerence.


Regards

Aji Cherian
Back to top
View user's profile Send private message
balajiofcrrcoe

New User


Joined: 07 Jul 2005
Posts: 41
Location: chennai

PostPosted: Mon Feb 13, 2006 3:40 pm    Post subject: Re: Problem to handle strings
Reply with quote

Hi,
try like this also it's working

MOVE 'NAGA NAGA SIVA RAO' TO A.
INSPECT A TALLYING C FOR ALL 'NAGA'.
DISPLAY C.


result is 2


please let me know in case of further clarifications.

Regards,
Naga samba siva rao varanasi
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us