The name VSAM states that it is all about storage and Access method. Read my previous post on VSAM.
- Each record has one or more key fields.
- With key field we can access the data randomly. KSDS provides for both Random and Sequential access
- IMS uses KSDS datasets extensively.
- These records can be of Variable in length.
- It consists of Data component and Index component.
- KSDS extensively being used for Master records – Inventory, Customer, Employee
- KSDS is less efficient because of Index overhead
- These are sequential files.
- Records are written in sequentially.
- These datasets extensively being used in IMS, DB2 and CICS
- These records are in sequence
- Records can be accessed directly by (RBA)
- The records in ESDS are often in either Ascending or Descending order
- It is possible, we can also access records through Alternative Index
- These records can be accessed by relative record numbers. By Record#1 , Record#2…..etc.
- It is possible to read records randomly with Index. However,here records are stored in slots. These slots internally read in sequence. So, sequential access is more efficient than access by using Index.
- Drawback of RRDS is vacant slots. This is main drawback wastage of space, and RRNs are empty.
- These records are byte-stream datasets.
- Db2 uses extensively this type of datasets.
- Very rarely used by application programs.
- The records are written in byte format, so these are called byte-stream datasets.
VSAM Re-usable datasets:
VSAM lets you define an ESDS, a KSDS, or an RRDS as a reusable data set. When a reusable data set is opened for output, VSAM resets the data set so all of its records are ignored and the records of the new data set overwrite the old records.
With a reusable ESDS, for example, VSAM keeps track of the highest relative byte address (RBA) that is used by the data set. Then, when the data set is opened for input or for I/O, VSAM reads all the records sequentially until it reaches the highest RBA. But when the data set is opened for output, VSAM resets the RBA to zero so the old records can be overwritten by the new records. By using a reusable data set, you are able to define a VSAM data set just once and use it repeatedly.