Define Fixed-length KSDS Example


Scenario - Creating KSDS with fixed-length records of size 47 bytes.

JCL -

----+----1----+----2----+----3----+----4----+----5
//MATEPKE JOB (123),'MTH',CLASS=A,
//             MSGCLASS=A,
//             MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//*********************************************
//* DEFINE VSAM FIXED-LENGTH KSDS
//*********************************************
//STEP01   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD  *
  DEFINE CLUSTER -
    (NAME(MATEPK.TEST.KSDS)  -
     RECORDSIZE(47,47)    -
     CYLINDERS(2,1)       -
	 FREESPACE(10,20)     -
	 KEYS(3,0)            -
     CISZ(4096)           -
     VOLUMES(DEVHD4)      -
     INDEXED              -
     REUSE     )          -
  DATA(NAME(MATEPK.TEST.KSDS.DATA)) -
  INDEX(NAME(MATEGJ.TEST.KSDS.INDEX))
/*

Output -

Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, KSDS successfully created.

KSDS SYSPRINT

Verify the KSDS in 3.4 (Dataset List utility) or any File management tools.

KSDS OUTPUT

Explaining Example -

In the above example,

  • RECORDSIZE(47,47) specifies the record average length is 47, and the maximum length is 47. So the KSDS file we are creating is fixed-length.
  • CYLINDERS(2,1) specifies the primary memory allocation is 2 CYLINDERS, and secondary memory allocation is 1 CYLINDER.
  • KEYS(3,0) specifies the key length is 3 bytes from the starting position 0.
  • CISZ(4096) specifies the control interval size is 4096.
  • VOLUMES(DEVHD4) specifies that allocate the KSDS on volume DEVHD4.
  • INDEXED parameter specifies the file is to create KSDS.
  • REUSE specifies the memory can reuse immediately once the file gets deleted.