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

HOW TO FINDOUT THE 2ND OCCURENCE OF A STRING IN A BIG PROG?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shivakumar .b
Warnings : 1

New User


Joined: 11 May 2005
Posts: 18
Location: bangalore

PostPosted: Wed May 18, 2005 4:43 pm
Reply with quote

HELLO EVERYBODY,
THIS IS SHIVAKUMAR.
IN ONE OF MY INTERVIEW, I WAS ASKED THE FOLLOWING QUESTION.
-- SUPPOSE IF A PROGRAM CONTAINS SOME THOUSANDS OF LINES AND IF U WANT TO LOCATE A STRING TO SEE THAT IN WHICH R ALL THE LINES THAT STRING IS PRESENT. WHAT HE ASKS IS, SUPPOSE IF FIRST OCCURANCE OF STRING IS IN 10TH LINE AND SECOND OCCURENCE IS IN 2000TH LINE. THEN WITHOUT USING PAGE DOWN OPTION HOW CAN U IMMEDIATELY KNOW WHERE IS THE SECOND OCCURENCE?OR IS IT POSSIBLE TO DISPLAY ONLY THOSE LINES WHICH CONTAIN THAT STRING?
ANYBODY PLZ GET ME THE ANSWER.
THANKS IN ADVANCE.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Wed May 18, 2005 5:14 pm
Reply with quote

I assume that you are working in TSO then I think that you can use an exclude command as:
X ALL
from the command line and then you can find your string with relative position in order of lines:
F 'mystring' ALL

you will receive all the line that contains your string.

If you need a precise order of row you must renum your program before the exclusion/find with commands: RENUM and UNNUM
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Wed May 18, 2005 5:22 pm
Reply with quote

Ehm.... but without complicate the problem I think that a Find and an PF5(that in much cases is set to rfind) will solve your request.

If PF5 does not work view your personal keys setting with command KEYS
and then substitute the function of command F5:
Code:
K Key       Definition                                 Format  Label   
K F1 . . .  HELP                                       SHORT   Help     
K F2 . . .  SPLIT                                      LONG    Split   
K F3 . . .  EXIT                                       SHORT   Exit     
K F4 . . .                                                             
K F5 . . .  RFIND                                      SHORT   Rfind   
Back to top
View user's profile Send private message
shivakumar .b
Warnings : 1

New User


Joined: 11 May 2005
Posts: 18
Location: bangalore

PostPosted: Thu May 19, 2005 10:33 am
Reply with quote

THANKS MGINDACO.
THANKS A LOT.
Back to top
View user's profile Send private message
joseph ladish

New User


Joined: 28 Mar 2006
Posts: 3

PostPosted: Tue Mar 28, 2006 10:44 pm
Reply with quote

hi,

this will perform ur operation


type f followed by that sting then the first time this will display the first string then u have to press f5 key then this will locate the next occurence


plz try this
joseph
Back to top
View user's profile Send private message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Wed Mar 29, 2006 10:07 am
Reply with quote

You just follow the MGINDACO solution.....

Code:
CMD ===> X ALL;F ALL <your string>



Thanks,
Rajesh
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Mar 30, 2006 6:43 am
Reply with quote

It's really your preference and perhaps the situation you find yourself in. The "x al"l solution makes it easier to compare the 2 stmts that you find the string in. For example:

-------------------------------------------------------------------------------------
000100 1ST OCCURANCE OF THE STRING
-------------------------------------------------------------------------------------
000950 2ND OCCURENCE OF THE STRING
-------------------------------------------------------------------------------------

You can easily notice that OCCURENCE is spelled differently in each line.
This might be harder to catch w/the PF5 approach.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts Search string in job at regular Spool... CLIST & REXX 0
Search our Forums:

Back to Top