MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to define more than one columns in primary key for VSAM.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Data Management
View previous topic :: View next topic  
Author Message
vijaylaxmisg
Beginner


Joined: 29 May 2007
Posts: 8
Topics: 4

PostPosted: Tue Jul 17, 2007 5:23 am    Post subject: How to define more than one columns in primary key for VSAM. Reply with quote

Hi All,

I need to define a VSAM with primary key as
Account number and SSN Number,
But the data defintion is

05 Account
10 Account Number
05 SSN Details
10 SSN Number

The above definition is only as an example,
Now I want to define primary key on Account number and SSN.
How my Record key clause looks like?

Thank you,

Regards-
Viji
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Tue Jul 17, 2007 5:30 am    Post subject: Reply with quote

VSAM keys must be contiguous, you will need to swap "SSN Details" with "SSN Number".
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Jul 17, 2007 6:04 am    Post subject: Reply with quote

before I start, Columns is a DB2 term. VSAM records have fields.

how about:
Code:

05  <data descriptions - if any>
05  XXXX-RECORD-KEY.
    10 ACCOUNT.
       15 ACCOUNT-NUMBER    PIC whatever.
    10 SSN-DETAILS.
       15 SSN-NUMBER        PIC whaterver.
05  <other data descriptions>

This way you can refer to the complete key as a group item XXXX-RECORD-KEY, where XXXX is whatever to differentiate between different VSAM records.
each portions of the key as group (x-type) ACCOUNT and SSN-DETAILS, and each portion of the key as a data-element ACCOUNT-NUMBER (comp, display) and SSN-NUMBER (display, comp) Hopefully, the SSN is not maintained with editing symbols (i.e. -,/,).

as CICS Guy said, the elements of a VSAM KEY must be contiguous and ordered.

The record key clause would be XXXX-RECORD-KEY.
_________________
Dick Brenholtz
American living in Varel, Germany


Last edited by dbzTHEdinosauer on Tue Jul 17, 2007 6:52 am; edited 1 time in total
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Tue Jul 17, 2007 6:24 am    Post subject: Reply with quote

CICS Guy wrote:
VSAM keys must be contiguous, you will need to swap "SSN Details" with "SSN Number".
My bad.... Embarassed
Missed the fact that the details is a group name...
Back to top
View user's profile Send private message
vijaylaxmisg
Beginner


Joined: 29 May 2007
Posts: 8
Topics: 4

PostPosted: Tue Jul 17, 2007 10:03 pm    Post subject: Reply with quote

Thank you very Much for your reply Smile
I jsut wanted to explore the chance of using non-contigous keys.

Thank you Ones again.
Back to top
View user's profile Send private message
jajularamesh
Beginner


Joined: 14 Apr 2006
Posts: 87
Topics: 33

PostPosted: Thu Jul 19, 2007 1:16 am    Post subject: Reply with quote

Hi vijaylaxmisg,

Change/Reformat the layout file so that the key fields are continous and then define it as a key

Regards,
Venkata Apparao Jajula
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Data Management All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group