How to randomly access the vsam file using partial key?

Virtual Storage Access method - ESDS, KSDS, RRDS & LDS. Basic direct access method, Basic sequential -, Queued sequential -, Basic partitioned -, Indexed sequential -, Object - access method.
Post Reply
alpna
Registered Member
Posts: 56
Joined: Fri Jun 21, 2013 10:35 pm

How to randomly access the vsam file using partial key?

Post by alpna »

Hello All,

How to randomly access the vsam file using partial key? I don't have much hands on with VSAM, can someone please help?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: How to randomly access the vsam file using partial key?

Post by nicc »

What have you tried so far?
Regards
Nic
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: How to randomly access the vsam file using partial key?

Post by Robert Sample »

If you are accessing the VSAM KSDS data set (it is NOT a file) via the primary key, then you cannot use a partial key. However, as long as the partial key is the start of the key in COBOL you can use START to browse. If the partial key is not at the start of the key, then you must read the entire data set sequentially and compare the piece of the key you have against the record (or define an alternate key on those bytes of the primary key).

If you are accessing via an alternate index then you can use a partial key as long as the partial key is the start of the key.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “SMS & VSAM and BDAM, BSAM, QSAM, BPAM, ISAM, OAM.”