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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: HOW TO FINDOUT THE 2ND OCCURENCE OF A STRING IN A BIG PROG?
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    Post subject:
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    Post subject:
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    Post subject: Re: HOW TO FINDOUT THE 2ND OCCURENCE OF A STRING IN A BIG PR
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    Post subject: Re: HOW TO FINDOUT THE 2ND OCCURENCE OF A STRING IN A BIG PR
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    Post subject:
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    Post subject:
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    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
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm
No new posts Which function does the Ampersand (&a... Andi1982 PL/I & Assembler 3 Wed Aug 24, 2016 2:05 pm
No new posts How to get the program name of callin... pkmurali COBOL Programming 8 Mon Aug 01, 2016 3:36 am


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