Page 1 of 1

create a vsam file in which keys is in multiple position

PostPosted: Sat Dec 24, 2016 2:51 pm
by arya_starc
Hi guys,
I need to create a vsam file in which I need a key at multiple position. but It is returning max cc 12 with below code


IF MAXCC < 12 THEN SET MAXCC=0                                      
DEFINE CLUSTER                                                 -    
      ( NAME(JVPS.AY.file.fORCE.KE)         -            
      FREESPACE(20 10)                                         -    
      INDEXED DATACLASS(DC4GCOMP) STORAGECLASS(SCNORMAL)       -    
      KEYS(2,10,19,17)                                         -    
      REUSE                                                    -    
      RECORDSIZE(016104,016104)                                    -
      SHAREOPTIONS(2,3)                                        -    
      SPEED                                                    -    
      VOLUME(* * * * *))                                       -    
  DATA                                                         -    
 


I need a key at 11th and 17th position

Re: create a vsam file in which keys is in multiple position

PostPosted: Sat Dec 24, 2016 3:06 pm
by enrico-sorichetti
I need a key at 11th and 17th position

You do not always get what You want.

why not read the manuals Yourself to find out about the VSAM RULES :mrgreen:

Re: create a vsam file in which keys is in multiple position

PostPosted: Sat Dec 24, 2016 7:39 pm
by Robert Sample
You may "need" it, but since it is not possible to do this (IBM tells you a KSDS key must be contiguous), you have two choices:
1. reorganize the data in the records so the key parts are contiguous
2. give up on the idea of defining this VSAM data set and move on to a different project.

Re: create a vsam file in which keys is in multiple position

PostPosted: Fri Dec 30, 2016 5:04 pm
by mbenaud
You could use an alternate index. Define the key for the main VSAM dataset and then create an alternate index using "DEFINE AIX, PATH and PATHENTRY"

Re: create a vsam file in which keys is in multiple position

PostPosted: Fri Dec 30, 2016 6:22 pm
by Robert Sample
mbenaud, there was not enough information posted for your "solution" to be valid. A KSDS primary key must be unique; if some of the bytes starting at 17 are required to make the key unique (that is, if there is some duplication of the bytes starting at 10), then the record has to be rearranged to ensure the primary key is contiguous bytes since KSDS primary keys cannot be in more than one location in the record.