Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 2: VSAM Concepts

ESDS- Entry Sequenced Data Sets

  • As name implies, data records in ESDS organized in the sequence based on the order in which they are inserted.
  • ESDS have only data component
  • ESDS does not contain key field value, thus It can contain duplicate records
  • ESDS organization acts like sequential files with some added features
  • ESDS records can be access sequentially or randomly
  • ESDS dataset can have alternate index which need not be unique
  • ESDS allows storing of fixed as well as variable length records
  • In a ESDS organization, records are always kept in order in which they are inserted
  • ESDS allows deleting of records (marking it as inactive) but it is not physically deletion. Thus there exist no free space to add any new records in that place.
  • In ESDS records are always appended (added at end)
  • ESDS allows spanned records
  • For ESDS datasets, we must code NONINDEXED inside the DEFINE CLUSTER command. This will be explained further in next Module
  • Like other files, ESDS can be used in COBOL. For this, we can specify the name of the file in JCL and we can use it inside COBOL program for processing. To use ESDS file in COBOL program, specify file organization as SEQUENTIAL and access mode can be specified as SEQUENTIAL

Internal organization of ESDS

  • As mentioned earlier ESDS dataset have only Data component. It does not have index component
  • A record can be accessed sequentially or directly by its RBA. In an ESDS dataset of 100 byte records, the RBA of the first record is 0, the RBA of the second record is 100, the RBA of the third record is 200, etc.
  • Sequential Access: - VSAM automatically fetches records in stored sequence. Sequential access can be started from beginning of the dataset or from somewhere in the middle if the dataset. If we want begin accessing records from the middle of dataset, this can be done by specifying RBA correctly.
  • Direct (or Random) Access: - When a record is added, VSAM captures its RBA. To fetch records directly, you must supply the RBA for the record as a search argument. Even though ESDS does not contain an index component, you can build an alternate index to keep track of these RBAs.

What makes ESDS different from PS(QSAM) file?

  • PS files can be stored on tape but ESDS cannot be stored on tape.
  • Unlike PS file, ESDS file can have Alternate Index. This alternate index has alternate key mapped with RBA. Thus both Indexed and random access are possible whereas it is not possible with PS

© copyright mainframebug.com
Privacy Policy