VSAM - ESDS


Advertisements

ESDS is known as Entry Sequenced Data Set. An entry-sequenced data set behaves like sequential file organization with some more features included. We can access the records directly and for safety purpose we can use passwords also. We must code NONINDEXED inside the DEFINE CLUSTER command for ESDS datasets. Following are the key features 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.

Defining ESDS cluster

The following syntax shows which parameters we can use while creating ESDS cluster. The parameter description remains the same as mentioned in VSAM - Cluster module.

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))  

Example

Following example shows how to create an ESDS cluster in JCL using IDCAMS utility −

//SAMPLE JOB(TESTJCL,XXXXXX),CLASS = A,MSGCLASS = C
//STEP1  EXEC PGM = IDCAMS
//SYSPRINT DD  SYSOUT = *
//SYSIN    DD  *
   DEFINE CLUSTER (NAME(MY.VSAM.ESDSFILE)  -
   NONINDEXED                              -
   RECSZ(80 80)                            -
   TRACKS(1,1)                             -
   CISZ(4096)                              -                            
   FREESPACE(3 3) )                        -
   DATA (NAME(MY.VSAM.ESDSFILE.DATA))      
/*

If you will execute the above JCL on Mainframes server. It should execute with MAXCC = 0 and it will create MY.VSAM.ESDSFILE VSAM file.

Deleting 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]

Above syntax shows which parameters we can use while deleting ESDS cluster. The parameter description remains the same as mentioned in VSAM - Cluster module.

Example

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

//SAMPLE JOB(TESTJCL,XXXXXX),CLASS = A,MSGCLASS = C
//STEPNAME EXEC PGM = IDCAMS
//SYSPRINT DD  SYSOUT = *
//SYSIN    DD  *
   DELETE MY.VSAM.ESDSFILE CLUSTER
/*

If you will execute the above JCL on Mainframes server. It should execute with MAXCC = 0 and it will delete MY.VSAM.ESDSFILE VSAM Cluster.

Advertisements