IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem to handle strings


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Need to add field to copybook, proble... COBOL Programming 14
Search our Forums:

Back to Top