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

how can i read nth record directly in vsam ksds?


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

Senior Member


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

PostPosted: Thu Aug 14, 2008 12:23 pm
Reply with quote

how can i read nth (say 10th here) record in vsam ksds file?
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Aug 14, 2008 12:30 pm
Reply with quote

Using ?
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Thu Aug 14, 2008 12:32 pm
Reply with quote

using cobol.
and i dont know the key
but i know the position i.e. it is tenth record in the file.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Thu Aug 14, 2008 12:55 pm
Reply with quote

Read sequentially from the beginning 9 records and the next one is yours.

No magic. Or did I lost so much during my holiday?
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Thu Aug 14, 2008 1:38 pm
Reply with quote

i want to reach directly to nth record not by reading it sequentialy.
is there any other way to do that?
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Thu Aug 14, 2008 1:44 pm
Reply with quote

With a KSDS and except if your key represents the sequence of the records, I cannot see a way to do it.
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: Thu Aug 14, 2008 9:00 pm
Reply with quote

Hello,

Even if you could directly read the nth record, what business need would it fill?

What happens when a few records are added or deleted and "that" record changes positon in the file?

If you explain the requirement, we may be able to offer suggestions.

Pierre,
Quote:
Or did I lost so much during my holiday?
No telling what may happen when you leave on holiday icon_smile.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Mon Aug 18, 2008 10:38 am
Reply with quote

Hi Dick,

there is huge file but specific chunk of data i . ae.
if rec 1 has value x then read from rec 1 to end
if rec 1 has value y then read from rec hm to rec m+value fetched from rec 1
if rec 1 has value z then read from rec hm to rec n+value fetched from rec 1
etc.


currently in production logic is implemented such that file is getting read sequentially keeping count of record and only records required are used using count.
so every time file is read till last record required from start.
I was thinking if it is possible to read first record and directly jump to required record no it will improve performance by lot.
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: Mon Aug 18, 2008 11:45 am
Reply with quote

Hello,
Quote:
I was thinking if it is possible to read first record and directly jump to required record
Not that i'm aware of.

How does rec1 get built with these values x, y, z? If rec1 could be built using key values rather than numbers of records you should be able to accomplish what you need.
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Mon Aug 18, 2008 12:24 pm
Reply with quote

Hi Sambhaji,


You can do that by populating high values to the key fields of that file

ex;

consider a vsam file with structure

Code:
01 emp-rec.
     03 emp-id            pic x(05)    >>>   key value
     03 emp-name       pic x(20).
     03 emp-sal           pic 9(4).



After validating first record, simply populate High-values or X'FFFFF' to
key fields(ie emp-d). and read that record....

Just check it out and let me the result...
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Aug 18, 2008 1:18 pm
Reply with quote

This silliness is yet another reason to migrate to db2.
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 Error to read log with rexx CLIST & REXX 11
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top