TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

VSAM - Define Cluster Syntax


JCL IDCAMS utility is used to define a cluster. The following syntax shows the important parameters in define Cluster.

Syntax:

DEFINE CLUSTER
     (NAME(vsam-file-name)     -
      BLOCKS(number)           -
      VOLUMES(volume-serial)   -
      [INDEXED / NONINDEXED / NUMBERED / LINEAR] -
      RECSZ(average maximum)   -
      [FREESPACE(CI-Percentage,CA-Percentage)] -
      CISZ(number)             -
      [KEYS(length offset)]    -
      [READPW(password)]       -
      [FOR(days)|TO(date)]     -
      [UPDATEPW(password)]     -
      [REUSE / NOREUSE] )      -
DATA                           -
      (NAME(vsam-file-name.data)) -
INDEX                          -
      (NAME(vsam-file-name.index)) -
CATALOG(catalog-name[/password]) ) 

Parameters at the CLUSTER level apply to the entire cluster. Parameters at the DATA or INDEX level apply only to the data or index component.

Explanation:

  • DEFINE CLUSTER

    Define Cluster command is used to define a cluster and specify parameter attributes for the cluster and its components.

  • NAME

    NAME specifies the name of VSAM file for which we are defining the cluster.

  • BLOCKS

    Blocks specifies the number of blocks assigned for the cluster.

  • VOLUMES

    Volumes specifies one or more volumes that will contain the cluster or component.

  • INDEXED / NONINDEXED / NUMBERED / LINEAR

    This parameter can take three values INDEXED, NONINDEXED or NUMBERED depending upon the type of dataset we are creating. For key-sequenced(KSDS) files INDEXED option is used. For entry-sequenced(ESDS) files the NONINDEXED option is used. For relative-record(RRDS) files the NUMBERED option is required. For Linear(LDS) files the LINEAR option is required. The default value of this parameter is INDEXED. We will discuss more about KSDS, ESDS, RRDS and LDS in coming modules.

  • RECSZ

    Record Size parameter has two values which are Average and Maximum record size. The Average specifies the average length of the logical records in the file and the Maximum denotes the length of the records.

  • FREESPACE

    Freespace specifies the percentage of free space to reserve for the control intervals (CI) and control areas (CA) of the data component. The default value of this parameter is zero percentage.

  • CISZ

    CISZ is known as Control interval size. It specifies the size of control intervals.

  • KEYS

    Keys parameter is defined only in key-sequenced (KSDS) files. It specifies the length and offset of primary key from first column. The range of value of this parameter are from 1 to 255 bytes.

  • READPW

    Value in READPW parameter specifies the password of read level.

  • FOR/TO

    The value of this parameter specifies the amount of time in terms of date and days for retaining the file. The default value for this parameter is zero days.

  • UPDATEPW

    Value in UPDATEPW parameter specifies the password of update level.

  • REUSE / NOREUSE

    REUSE parameter allows clusters to be defined that may be reset to empty status without deleting and re-defining them.

  • DATA - NAME

    The DATA part of the cluster contains the dataset name which contains the actual data of the file.

  • INDEX-NAME

    The INDEX part of the cluster contains the primary key and the memory pointer for the corresponding record in the data part. It is defined when a Key Sequenced cluster is used.

  • CATALOG

    Catalog parameter denotes the catalog under which the file will be defined. We will discuss about catalog separately in upcoming modules.


Let us see an example below for define cluster.

//JOBNAME1 JOB 'IBMMAINFRAMER',CLASS=A,MSGLEVEL=(1,1),MSGCLASS=A
//*
//STEP001  EXEC PGM = IDCAMS
//SYSPRINT DD  SYSOUT = *
//SYSIN    DD  *
   DEFINE CLUSTER
    (NAME(racfid.VSAM.KSDSFILE.TEST)  -
     INDEXED                                 -
     RECSZ(80 80)                            -
     TRACKS(1,1)                             -
     KEYS(5  0)                              -
     CISZ(4096)                              -
     FREESPACE(3 3) )                        -
   DATA
     (NAME(racfid.VSAM.KSDSFILE.TEST.DATA))      -
   INDEX
     (NAME(racfid.KSDSFILE.TEST.INDEX))
/*

If you execute the above JCL. Job should complete successfully with MAXCC = 0 and it will create racfid.VSAM.KSDSFILE.TEST VSAM file.


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal