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

How to handle the unwanted field inside the primay key


IBM Mainframe Forums -> JCL & VSAM
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 6:27 pm
Reply with quote

Hi
My requirement is below

For a VSAM KSDS file of length 400 the fields are below
Field-1 Pic x(15)
FIELD-2 pIC X(30)
FIELD-3 PIC X(6)
FIELD-4 PIC X(4)
FIELD-5 pic x(7)
---
---etc

I need FIELD-3 and FIELD-5 as primary keys.Since for primary key the field should be contagious, i am taking FIELD-4 also
say
05 Ws-group
07 FIELD-3 pic x(6)
07 FIELD-4 pic x(4)
07 FIELD-5 pic x(7)

I am giving Ws-group as my key in RECORDKEY CLAUSE

Here my Question is
How can i read this VSAM file with only field-3 and field-5?
How to suppress the field-4 when reading since field-4 is not needed?

Please help
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Sep 17, 2010 7:02 pm
Reply with quote

you are not making any sense.

if the ksds vsam file exists, then a primary key already exists and you are actually asking how to define an alternate key.

if the ksds vsam file does not exist, rearrange the fields.

this REDBOOK, VSAM Demystifed may come in handy.
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 8:07 pm
Reply with quote

Quote:
How can i read this VSAM file with only field-3 and field-5?
You cannot -- you can do a generic read on field-3, but that's as far as you can go with the key defined the way you have it.
Quote:
How to suppress the field-4 when reading since field-4 is not needed?
You cannot -- the values in field 4 are part of the key and must be taken into account when accessing the file.

As Dick said, either live with the file as it exists, or rearrange the fields to create one contiguous primary key.
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
No new posts calling a JCl inside a JCL JCL & VSAM 3
Search our Forums:

Back to Top