Accessing vsam file with multiple keys.



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Accessing vsam file with multiple keys.

Postby gokulNmf » Sun Mar 29, 2009 9:40 pm

Hi,
I want to create a vsam with multiple keys is it possible while declaring keys during creation like,
keys (3,3,8,3,15,3)
where 3,8,15 are the starting positions of the keys?
Cheers,
Gokul
User avatar
gokulNmf
 
Posts: 118
Joined: Sat Mar 28, 2009 6:41 pm
Location: India
Has thanked: 2 times
Been thanked: 0 time

Re: Accessing vsam file with multiple keys.

Postby dick scherrer » Sun Mar 29, 2009 11:18 pm

Hello and welcome to the forum,

is it possible while declaring keys during creation like,
keys (3,3,8,3,15,3) where 3,8,15 are the starting positions of the keys

No.

You need to define one unique primary key (if all 3 fields are needed to make up a unique value, re-arrange them in this vsam record). If one of the fields will be unique, it might become the primary key and the others defined as alternate indexes.

Here is the Table of Contents for the IDCAMS documentation link:
http://publibz.boulder.ibm.com/cgi-bin/ ... 0/CONTENTS?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Accessing vsam file with multiple keys.

Postby gokulNmf » Sun Mar 29, 2009 11:58 pm

Thank you I will try out by rearranging them.
Cheers,
Gokul
User avatar
gokulNmf
 
Posts: 118
Joined: Sat Mar 28, 2009 6:41 pm
Location: India
Has thanked: 2 times
Been thanked: 0 time

Re: Accessing vsam file with multiple keys.

Postby dick scherrer » Mon Mar 30, 2009 12:40 am

Hello,

FWIW - many (most) ksds vsam files are defined with the primary key as the first n bytes of the record.

I probably should have mentioned that earlier. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post