Selecting VSAM Dataset Type


Selection of VSAM Dataset types?


The application programmer has to use a VSAM dataset in his day-to-day activities during the application development process. At that time, the application developer has to select a suitable dataset type based on his requirement.

The factors involved in decision-making are data organization, function, type of access, performance, and recovery tools. Before going to select the specific VSAM dataset, raise the below questions to get more clarity on what dataset to select -

  • What is the main purpose of the dataset? Simple dataset, log file, a database, or an inventory?
  • What is the mode using to access the data by using the key? (Sequential or direct)
  • How do we access the records? (In sequence, skip sequential, randomly, or all of them)
  • What type of logical records? (Fixed-length or Variable-length)
  • Does the processing have insertions or deletions?
  • Possibility of deleting records? If yes, How often?
  • Requirement of IDCAMS utility functions?
  • What is the order to keep the records in the dataset? (Based on the key field or based on the insertion or RBA or RRN)
  • Possibility of length change in the middle of processing?
  • Requirement of accessing data by an alternate index?
  • Do we use spanned records?
  • Possibility of data compression?
  • Possibility of dataset extension?

Use the above answers to select the best VSAM dataset that fits the requirement.

Note! VSAM access method cannot process non-VSAM datasets, and non-VSAM application cannot process VSAM datasets.

Guidelines to select dataset -


Following are some guidelines for choosing a dataset organization. The organizations are presented in the order from lowest to highest in processor and I/O consumption.

Choose QSAM or BSAM when -

  • No direct processing.
  • No insertions and deletions.
  • We are adding records only at the end of the dataset.
  • No requirement of IDCAMS functions.
  • No logical record length change.
  • Require data compression.
  • Performance and recovery are the main concerns.

Choose ESDS when -

  • A requirement of reading records sequentially.
  • There is no issue with adding logical records only at the end of the dataset.
  • The logical record is variable-length.
  • Using a batch processing application.
  • Need direct record processing by key (using AIX) rarely.

Choose KSDS when -

  • Data access is sequential, skip sequential, or direct access by a key field.
  • Prefer easy programming for direct data processing.
  • Having many record insertions, deletions, and logical record length variations.
  • Recovery is not a problem.
  • Accessing records by an alternate index optionally.
  • Require data compression.

Choose fixed-length RRDS when -

  • Record processing is sequential, skip sequential, or direct processing.
  • The accessing data argument is an RRN in direct mode, not the key.
  • All records are fixed length.
  • Very few record insertions and deletions, and all the space for insertions should be pre-allocated in advance.
  • Easy programming is not a requirement for direct processing.
  • Performance is an issue. (RRDS performance is better than KSDS but worse than QSAM or BSAM).

Choose variable-length RRDS when -

  • Having the exact requirements for a KSDS, but use RRN instead of a key field as the argument.

Choose LDS when -

  • Using DIV.
  • Application manging logical records.
  • Performance is an issue.