Skip to content
systemcoding.dev
Mainframe

Define a KSDS with DEFINE CLUSTER INDEXED KEYS

Define a key-sequenced VSAM cluster with IDCAMS DEFINE CLUSTER, INDEXED and KEYS, on z/OS 3.1.

1 min read
Summarize in AI

A KSDS is the VSAM type you reach for when records are found by a key. In IDCAMS on z/OS 3.1 the INDEXED parameter makes it key-sequenced, and KEYS(length offset) says where the key sits in the record.

jcl
//DEFKSDS  EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DEFINE CLUSTER (NAME(USER1.CUSTOMER.KSDS) -
         INDEXED -
         KEYS(8 0) -
         RECORDSIZE(80 80) -
         CYLINDERS(1 1) -
         VOLUMES(VOL001))
/*
Text
IDC0508I DATA ALLOCATION STATUS FOR VOLUME VOL001 IS 0
IDC0509I INDEX ALLOCATION STATUS FOR VOLUME VOL001 IS 0
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0

KEYS(8 0) means an eight-byte key starting at offset 0, which is the first byte of the record, not column 1 of a card image. The - at the end of each line is the IDCAMS continuation character. IDCAMS creates the cluster with a data and an index component, and the names .DATA and .INDEX are generated unless you give DATA(NAME(...)) and INDEX(NAME(...)).

Leave out VOLUMES on an SMS-managed system and let the storage group choose. Keys cannot change after the cluster is defined, so decide on them before you load any data.

Taggedjclvsam
Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.