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

Can a VSAM KSDS file will have a 2 unique keys?


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
esaccy
Currently Banned

New User


Joined: 19 Feb 2005
Posts: 22

PostPosted: Fri Sep 17, 2010 3:14 pm
Reply with quote

Can a VSAM file will have 2 unique keys?
My requiement
I have a KSDS file of 400 length.
I have 2 unique keys at
first key--(146,5)
Second key---(200,6)

Is it possible to define the KSDS file with these two feilds as key?
Moreover can we read a particular record with these two fields as keys.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Sep 17, 2010 3:18 pm
Reply with quote

Please refer to "Alternate Index" concept in the Manuals...
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Fri Sep 17, 2010 3:23 pm
Reply with quote

First question - NO, only one key is allowed and it must be unique and contiguous.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Sep 17, 2010 3:35 pm
Reply with quote

It is not clear what you are asking. The primary key for a KSDS must be contiguous so if you want to create a KSDS with an 11-byte key (5 bytes starting at 146, 6 bytes starting at 200), the answer is that this is not allowed. However, if you are saying that the primary key is 5 bytes starting at 146, and you want to use 6 bytes starting at 200 to merely read the KSDS, you can define those bytes as an alternate index (which can be defined to allow duplicates or to require unique keys).
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: Fri Sep 17, 2010 7:24 pm
Reply with quote

Hello,

Quote:
Is it possible to define the KSDS file with these two feilds as key?
Moreover can we read a particular record with these two fields as keys.
I believe the wording you chose here is causing confusion and getting different replies based on what we "understand" are the questions.

Suggest you post a few sample records (they don't have to be 200 bytes, only a few bytes will show what is needed) and how you want to implement the key(a). The show how you want to randomly read the file.
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top