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 based on his requirement.

However, VSAM has several organizations and different ways of accessing data. So developer should use some factors to choose a suitable dataset.

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 data set? 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?
  • Do we want to use DIV?
  • 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 data set 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 LDS when -

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

Choose 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 ESDS when -

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

Choose VRRDS when -

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

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.