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

VSAM - Entry Sequenced Data Set


ESDS is abbreviated as Entry Sequenced Data Set. An entry-sequenced data set is similar as sequential file organization with some additional features included. We can access the records directly and for safety purpose we can use passwords also.

When you define ESDS cluster, we must code NONINDEXED inside the DEFINE CLUSTER command.

Benifits of ESDS:

  • Records in ESDS cluster are stored in the order in which they were inserted into the dataset.

  • Records are referenced by physical address which is known as Relative Byte Address (RBA). Suppose if in an ESDS dataset, we have 80 byte records, the RBA of first record will be 0, RBA for second record will be 80, for third record it will be 160 and so on.

  • Records can be accessed sequentially by RBA which is known as addressed access.

  • Records are held in the order in which they were inserted. New records are inserted at the end.

  • Deletion of records is not possible in ESDS dataset. But they can be marked as inactive.

  • Records in ESDS dataset can be of fixed length or variable length.

  • ESDS is non-indexed. Keys are not present in ESDS dataset, so it may contain duplicate records.

  • ESDS can be used in COBOL programs like any other file. We will specify the file name in JCL and we can use the ESDS file for processing inside program. In COBOL program specify file organization as Sequential and access mode as Sequential with ESDS dataset.


Syntax: Define ESDS Cluster

DEFINE CLUSTER                               -
   (NAME(esds-file-name)                     -
    BLOCKS(number)                           -
    VOLUMES(volume-serial)                   -
    NONINDEXED                               -
    RECSZ(average maximum)                   -
    [FREESPACE(CI-Percentage,CA-Percentage)] -
    CISZ(number)                             -
    [READPW(password)]                       -
    [FOR(days)|TO(date)]                     -
    [UPDATEPW(password)]                     -
    [REUSE / NOREUSE])                       -
DATA                                         -
    (NAME(esds-file-name.data))  

The syntax parameter description remains the same as we explained in VSAM - Define Cluster Syntax chapter.


Example:

Let us see an example how to create an ESDS cluster in JCL using IDCAMS utility.

//JOBNAME1 JOB CLASS=C,PRTY=10,MSGCLASS=C,MSGLEVEL=(1,1),NOTIFY=&SYSUID
//STEP001  EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
  DEFINE CLUSTER                              -
      (NAME(racfid.VSAM.ESDSFILE.TEST)        -
      NONINDEXED                              -
      RECSZ(80 80)                            -
      TRACKS(1,1)                             -
      CISZ(4096)                              -
      FREESPACE(5 5) )                        -
   DATA                                       -
      (NAME(racfid.VSAM.ESDSFILE.TEST.DATA))
/* 

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


Syntax: Delete ESDS Cluster

ESDS cluster is deleted using IDCAMS utility. DELETE command removes the entry of the VSAM cluster from the catalog and optionally removes the file, thereby freeing up the space occupied by the object.

DELETE data-set-name CLUSTER
    [ERASE / NOERASE]
    [FORCE / NOFORCE]
    [PURGE / NOPURGE]
    [SCRATCH / NOSCRATCH]

The syntax parameter description remains the same as we explained in VSAM - Delete Cluster Syntax chapter.

Example:

Following example shows how to delete an ESDS cluster in JCL using IDCAMS utility.

//JOBNAME2 JOB CLASS=C,PRTY=10,MSGCLASS=C,MSGLEVEL=(1,1),NOTIFY=&SYSUID
//STEPNAME EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
   DELETE racfid.VSAM.ESDSFILE.TEST CLUSTER
/*

If you execute the above JCL. Job should complete successfully with MAXCC = 0 and it will delete racfid.VSAM.ESDSFILE.TEST VSAM Cluster.


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