The KSDS is one of the most popular types of VSAM dataset. It consists of at least three components, a CLUSTER definition, which is just a catalog entry, a DATA component and an INDEX component. It may also have alternate indexes, which are themselves three component KSDS files, and are connected to the base component by a PATH. The way this lot fits together is illustrated below.
The KSDS is versatile, because it can be read sequentially through the data component, or individual records can be accessed directly through the index. The way the index works is illustrated below. Data records consist of a primary index, which has to be unique, and data. Records are grouped together into Control Intervals, which is essentially the blocksize, then into Control Areas. The space in the control interval will include a 3 byte Record Descriptor Field for every record, and one 4 byte Control Interval Descriptor Field. You specify your CI size when you allocate the file, but the CA size is picked by the system.
Records are inserted within the file, in index order, and can be physically deleted.
More detail, especially for performance tuning a KSDS can be found in the VSAM tuning Guide
ESDS
An ESDS is a straightforward sequential dataset. It has a catalog CLUSTER entry and a DATA component, but nothing else. Records are always inserted at the end of the file, and cannot be physically updated or deleted without rewriting the whole file.
LDS
The LDS has no fixed internal record information, that is determined by the application. It is used for DB2 databases and SMS control files, among others. It has a CLUSTER and DATA components. If you look at a LDS with LISTCAT, the file will always appear to be empty, as it has no VSAM control information.
RRDS
The RRDS is included for completeness, but it is rarely used. It is a Direct Access dataset, with the data split up into fixed length slots and is difficult to extend. You can't replace individual records, as the file is not keyed. This means that you cannot load data into the file with the REPLACE option, you have to specify REUSE, which empties the file out first.
VSAM Enhancements
Extended the 4GB limit
It was possible to create KSDS files greater than 4GB, beginning with DFSMS V1.3. DFSMS V1.5 allows non-KSDS file types (ESDS, RRDS, and LDS) to exceed 4 gigabytes.
Transactional VSAM - Online/Batch file sharing
This is an enhancement to VSAM Record Level Sharing (RLS). RLS allowed batch jobs to read VSAM files while online CICS had the files open. This may be adequate for some applications, but other require that many tasks can concurrently update a VSAM file, while completely preserving data integrity.
Transactional VSAM Services became available with OS/390 V2.10, and allows VSAM data set sharing between batch and online systems, and between two or more batch jobs. It does this by logging and using two-phase commit and backout protocols at file level. Transactional VSAM uses the Automatic Restart Manager (ARM), so in the case of a system failure, VSAM services will be restarted on another system by ARM.