View previous topic :: View next topic
|
Author |
Message |
Sudhanshu Shekhar
New User
Joined: 23 Jul 2008 Posts: 27 Location: City of Joy
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
And Why Razz??? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
3.14 perchance ? |
|
Back to top |
|
|
Sudhanshu Shekhar
New User
Joined: 23 Jul 2008 Posts: 27 Location: City of Joy
|
|
|
|
@ 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 |
|
|
Sudhanshu Shekhar
New User
Joined: 23 Jul 2008 Posts: 27 Location: City of Joy
|
|
|
|
@ Expat... thanks sir 3.14 does it ... just never bothered to notice the line number it displays before... |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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.. . |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Anuj,
Quote: |
but isn't ISPF Find is enough |
Not if the file is too large. . .
d |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
What is this record number going to be used for? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Dick,
Quote: |
Not if the file is too large. . .
|
You can always browse the file
Gerry |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Gerry,
I should have invested a few more keystrokes. . .
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Dick,
I took the "too large" as in EDIT mode, so that was my line of thinking.
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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. . . |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
oh, it's a happy ending then |
|
Back to top |
|
|
|