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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: To Find the record number of the first occurence of a string
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    Post subject: Re: To Find the record number of the first occurence of a st
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: 8593
Location: Back in jolly old England

PostPosted: Tue May 04, 2010 3:02 pm    Post subject:
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    Post subject: Reply to: To Find the record number of the first occurence o
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    Post subject: Reply to: To Find the record number of the first occurence o
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    Post subject: Re: Reply to: To Find the record number of the first occuren
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: 7905
Location: Bellevue, IA

PostPosted: Tue May 04, 2010 5:08 pm    Post subject:
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

Senior Member


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

PostPosted: Tue May 04, 2010 5:52 pm    Post subject:
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

Site Director


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

PostPosted: Tue May 04, 2010 8:19 pm    Post subject: Reply to: To Find the record number of the first occurence o
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    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Wed May 05, 2010 3:56 am    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Wed May 05, 2010 4:47 am    Post subject:
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

Site Director


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

PostPosted: Wed May 05, 2010 7:47 am    Post subject:
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: 1703
Location: Australia

PostPosted: Wed May 05, 2010 9:59 am    Post subject:
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

Senior Member


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

PostPosted: Wed May 05, 2010 5:32 pm    Post subject:
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

Site Director


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

PostPosted: Wed May 05, 2010 9:51 pm    Post subject:
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

Senior Member


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

PostPosted: Thu May 06, 2010 2:57 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
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 sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am


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