Queued sequential access method

From Wikipedia, the free encyclopedia

In IBM mainframe operating systems, a queued sequential access method (QSAM) is one of the access methods for files, or more properly data sets. QSAM files are unkeyed, with the records placed one after another, according to entry order. A program can process these files only sequentially, retrieving (with the READ statement or GET macro instruction) records in the same order as they are in the file. Each record is placed after the preceding record.

QSAM files can be on tape, direct access storage devices (DASDs), unit-record devices, and terminals. QSAM processing is best for tables and intermediate storage.

To process QSAM files in a program, a programmer could use COBOL language statements that:

  • Identify and describe the QSAM files in the ENVIRONMENT DIVISION and the DATA DIVISION.
  • Process the records in these files in the PROCEDURE DIVISION.

After a record is created, its length or its position in the file cannot be changed, and it cannot be deleted. QSAM files can, however, be updated on DASD (using REWRITE).

The record definitions that are coded in COBOL program and the length of the variables read into and written from determines the amount of data transferred.

You can also access byte stream files in the HFS using QSAM. These files are byte-oriented sequential files with no record structure, modelled after those used in Unix-like and Windows systems. Such files cannot be updated using REWRITE.