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

To Find the record number of the first occurence of a string


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Tue May 04, 2010 2:48 pm
Reply with quote

Hi,

The requirement is to find the record number of the first occurence of a string.

For eg.

I got a file with say 5000000 rows, some of the rows contain the string "Hello world". The first occurence is @ say the 5000th row.Is there any utility i can run, which would give return me the record number of first occurence (i.e in this example 5000).
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 04, 2010 2:59 pm
Reply with quote

Sudhanshu Shekhar wrote:
Hi,

The requirement is to find the record number of the first occurence of a string.

For eg.

I got a file with say 5000000 rows, some of the rows contain the string "Hello world". The first occurence is @ say the 5000th row.Is there any utility i can run, which would give return me the record number of first occurence (i.e in this example 5000).


Yes SORT utility can do the job for you.
You need to tell what is the sort product installed at your shop.
then, RECFM\LRECL

BTW, file contain records not rows...

Sudhanshu Shekhar wrote:

Thanks in Advance icon_razz.gif

And Why Razz??? icon_rolleyes.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue May 04, 2010 3:02 pm
Reply with quote

3.14 perchance ?
Back to top
View user's profile Send private message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Tue May 04, 2010 3:49 pm
Reply with quote

@ Sambhaji ... DFSORT,SYNCSORT would do for me for FB/451. And Sorry for the Razz , it just thought it was cute... got a little weakness for cute thingies..
Back to top
View user's profile Send private message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Tue May 04, 2010 3:56 pm
Reply with quote

@ Expat... thanks sir 3.14 does it ... just never bothered to notice the line number it displays before...
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 04, 2010 4:14 pm
Reply with quote

Sudhanshu Shekhar wrote:
@ Expat... thanks sir 3.14 does it ... just never bothered to notice the line number it displays before...

Do you still want sort solution? What suggested by Expat is easiest one...
Quote:
And Sorry for the Razz , it just thought it was cute

No Worries.. . icon_smile.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue May 04, 2010 5:08 pm
Reply with quote

Quote:
I got a file with say 5000000 rows, some of the rows contain the string "Hello world"
Terminology is critical in IT, where similar terms may have vastly different meanings. Files do not have rows -- data bases have rows. Files have records. So your statement is completely untrue from the start -- the file cannot have any rows, period.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue May 04, 2010 5:52 pm
Reply with quote

I'm not sure if I uderstood the question - but isn't ISPF Find is enough, F 'string' and check the row number on left icon_confused.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue May 04, 2010 8:19 pm
Reply with quote

Hi Anuj,

Quote:
but isn't ISPF Find is enough
Not if the file is too large. . . icon_wink.gif

d
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue May 04, 2010 10:22 pm
Reply with quote

What is this record number going to be used for?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 05, 2010 1:58 am
Reply with quote

Crag Giegerich wrote:
What is this record number going to be used for?


same thing number of lines of code are used for...
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed May 05, 2010 3:56 am
Reply with quote

Hi Dick,

Quote:
Not if the file is too large. . .


You can always browse the file icon_smile.gif


Gerry
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 05, 2010 4:03 am
Reply with quote

Quote:
You can always browse the file


true, if you have nothing else to do.

tying-up a tso session for an activity like this is only for those with time-on-their hands.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed May 05, 2010 4:47 am
Reply with quote

Hi Dick,

I agree with your comment but all of the above solutions are tying up a tso session unless you go with the sort option.

My answer was based on "Not if the file is too large. "

Actually 3.14 will scan the entire file and return all matched strings.

With browse and F 'string', it will stop at first hit.


Gerry
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 05, 2010 7:47 am
Reply with quote

Hi Gerry,

I should have invested a few more keystrokes. . . icon_redface.gif

When i said "too large", i meant too much data to pass in some reasonable amount of time at the terminal - not counting the extra load placed on the tso system/environment.

When looking for a value in a file or comparing files, i nearly always do this in batch. However, much of qsam data i work with is 10's to 100's of millions of 12k records. . .
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed May 05, 2010 9:59 am
Reply with quote

Hi Dick,

I took the "too large" as in EDIT mode, so that was my line of thinking. icon_smile.gif

The one thing that often is not mentioned in the original request is where the data is stored, DASD or TAPE as some of the above options do not support TAPE.

Gerry
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed May 05, 2010 5:32 pm
Reply with quote

Sorry to say but I've lost the track of this thread - to start with I'm jut not sure, what are we answering on, what is the actual question!?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 05, 2010 9:51 pm
Reply with quote

Hi Anuj,

Quote:
to start with I'm jut not sure, what are we answering on, what is the actual question!?
TS was happy with 3.14 for what was needed.

This rest is just us kids having fun. . . icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu May 06, 2010 2:57 pm
Reply with quote

oh, it's a happy ending then icon_smile.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
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 SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top