VSAM Blocking: Logical Records in Physical Blocks

In VSAM, the physical unit of I/O is the control interval (CI), not the logical record. Multiple logical records are packed into each CI—this is what "blocking" means in VSAM. When the system reads one CI from disk, it gets many logical records in one physical read; when your program asks for one record, the access method uses the CI (and its buffers) to satisfy the request. Understanding blocking helps you see why CI size (CISZ) and record size affect how many records fit per I/O and how efficiently VSAM uses disk and memory. This page explains how logical records are stored in physical blocks (CIs), how blocking affects I/O, and how it differs from block-based access in non-VSAM files.

Logical Records vs Physical Blocks in VSAM

A logical record is the unit of data your program works with: the record you READ or WRITE, with a length defined by RECORDSIZE (average and maximum). A physical block in VSAM is the control interval (CI). The CI is a fixed-size chunk of the data component (e.g. 4096 or 8192 bytes). VSAM packs as many logical records as will fit into each CI, along with free space (for KSDS/RRDS) and control information: record descriptor fields (RDFs) and the control interval descriptor field (CIDF). So one "block" (one CI) holds many logical records. That is blocking: multiple logical records per physical I/O unit.

Logical record, physical block, and blocking
TermMeaning
Logical recordThe record as defined by your program: the unit of data you READ or WRITE. It has a length (RECORDSIZE) and may be fixed or variable.
Physical block (CI)The control interval: the fixed-size unit of data that VSAM transfers between DASD and memory. Multiple logical records (and free space, RDFs, CIDF) fit inside one CI.
BlockingThe packing of multiple logical records into one physical I/O unit (one CI). More records per CI means fewer I/Os for sequential processing.

Why VSAM Uses the CI as the Block

In non-VSAM sequential files (QSAM), you often specify a block size (BLKSIZE); the system reads and writes in those blocks, and multiple logical records can be blocked in one block. In VSAM there is no separate BLKSIZE; the control interval is the block. The CI size (CISZ) is set at DEFINE CLUSTER time (e.g. CISZ(4096) or CISZ(8192)). Every read and write is in whole CIs. So the CI is the physical block, and the number of logical records per CI depends on the record length, the CI size, and how much of the CI is reserved for free space and control info. For fixed-length 80-byte records and a 4096-byte CI with 10% free space, you might get dozens of records per CI; for 500-byte records, fewer. The access method calculates this when it stores and retrieves records.

How Blocking Affects I/O

When your program reads one logical record, VSAM does not necessarily perform one physical I/O. It checks whether the CI that contains that record is already in a buffer. If not, it reads the whole CI (one physical I/O) and then extracts the record. So one physical read can satisfy many logical reads if those records are in the same CI. For sequential processing, the system often reads CIs in order; each CI read brings in a block of records, and the program can process them one by one from the buffer. That reduces the number of disk I/Os. For random access, each request might need a different CI, so the benefit of blocking is that once a CI is in the buffer, any record in that CI can be returned without another I/O. So blocking (many records per CI) improves efficiency by amortizing the cost of one physical I/O over many logical records.

Control Interval Contents and Record Packing

Inside each CI, logical records are packed from the beginning. For variable-length records, each record has an RDF (record descriptor field) that describes its length. For fixed-length records, the RDF structure is simpler. Free space (in KSDS and RRDS) is reserved in the middle of the CI for inserts. The CIDF at the end of the CI holds control information (e.g. offset to free space). So the layout is roughly: [record 1][record 2]…[free space]…[RDFs][CIDF]. The exact layout is managed by VSAM. You do not specify block size or blocking factor; you specify RECORDSIZE and CISZ (and FREESPACE), and the system packs records into CIs accordingly. So "blocking" in VSAM is automatic: the number of records per CI is derived from the CI size, record size, and free space percentage.

Comparison with QSAM Blocking

In QSAM (and BSAM), you can specify DCB=(LRECL=80,BLKSIZE=800) so that 10 logical records fit in one block. The block is the unit of I/O. In VSAM, the CI plays the same role: it is the unit of I/O, and multiple logical records fit in one CI. The difference is that VSAM CIs have a fixed size set at define time (CISZ), and the blocking factor (records per CI) is not something you set directly—it follows from RECORDSIZE, FREESPACE, and CISZ. Also, VSAM CIs contain not only records but also free space and control information, so the "usable" space per CI for records is less than the full CISZ. So the idea of blocking (many logical records per physical I/O) is the same; the mechanism is CI-based and managed by VSAM.

Spanned Records and Blocking

Normally each logical record fits entirely in one CI. For very long records, VSAM supports spanned records: a single logical record can span two or more CIs. In that case, "blocking" is not just many records per CI but also parts of one record across CIs. The access method still uses the CI as the unit of I/O; when it needs the rest of a spanned record, it reads the next CI. So blocking still applies to the parts of the record that fit in each CI; the difference is that one logical record can occupy multiple CIs.

Key Takeaways

  • In VSAM, the physical block is the control interval (CI). Multiple logical records are packed into each CI—this is blocking.
  • The unit of I/O is always the CI. One physical read brings one CI (many logical records) into a buffer.
  • Blocking improves efficiency: fewer I/Os per logical record when processing sequentially or when reusing a CI already in the buffer.
  • Records per CI depend on CISZ, RECORDSIZE, and FREESPACE; you do not set a blocking factor directly.
  • Spanned records can cross CI boundaries; the CI remains the unit of I/O.

Explain Like I'm Five

Imagine a lunchbox (the CI). You don't bring one grape at a time; you fill the lunchbox with lots of grapes (logical records). When the teacher asks for one grape, you open the lunchbox once and take out one grape—the rest are already there for next time. Blocking is putting many grapes in one lunchbox so one trip (one I/O) brings many grapes. VSAM always carries whole lunchboxes (CIs); the grapes inside are the logical records.

Test Your Knowledge

Test Your Knowledge

1. What is the unit of I/O in VSAM?

  • One logical record
  • One track
  • One control interval (CI)
  • One control area

2. Where are logical records stored in VSAM?

  • One record per track
  • Packed into control intervals (CIs)
  • Only in the index
  • In a separate buffer

3. How does blocking help sequential read performance?

  • It does not
  • One I/O brings many records (one CI) into memory
  • It reduces key length
  • It increases free space
Published
Updated
Read time4 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: IBM z/OS 2.5 documentationSources: IBM DFSMS Access Method Services, z/OS VSAM documentationApplies to: z/OS 2.5