VSAM Control Area (CA)

In VSAM, the control area (CA) is the unit of space allocation on disk. While the control interval (CI) is the unit of I/O—the chunk of data that moves between DASD and memory—the CA is the larger grouping that determines how much space is reserved when you define a cluster and how growth is managed. A control area is made up of two or more control intervals. When you specify CYLINDERS or TRACKS in DEFINE CLUSTER, you are allocating in terms of CAs. Understanding the CA helps you see how VSAM uses space, why CA splits happen, and how FREESPACE and allocation choices affect performance and reorganization. This page explains what a control area is, how it relates to the control interval, how allocation works, and how CA splits occur.

What Is a Control Area?

A control area is a contiguous block of storage in the data component (or in the index component for KSDS) that contains two or more control intervals. Think of it as a "container" for CIs. The data component is a sequence of CAs; each CA is a sequence of CIs. The CA is not the unit that VSAM reads or writes in a single I/O—that is the CI. Instead, the CA is the unit that VSAM uses when it allocates space. When you define a cluster with CYLINDERS(10 5), VSAM allocates space in CA-sized chunks (typically one CA per cylinder, depending on the device and CI size). So the CA is the "allocation unit" and the CI is the "transfer unit."

On many systems, one control area corresponds to one cylinder of DASD. The number of CIs in a CA depends on the CI size (CISZ) and the size of the allocation unit. For example, if one cylinder holds 720 KB and each CI is 4 KB, one CA could hold 180 CIs. That relationship is determined by the access method when the cluster is defined; you do not specify "CA size" directly. You specify allocation (cylinders, tracks, or records) and CI size; VSAM formats the allocated space into CAs and CIs.

Control Area vs Control Interval

It is important to keep the two concepts distinct. The control interval is the fixed-size block that VSAM transfers in each read or write. The control area is the grouping of CIs that VSAM uses for space allocation and for CA splits. The following table summarizes the main differences.

Control area vs control interval
AspectControl interval (CI)Control area (CA)
Unit of I/OYes — VSAM reads/writes whole CIsNo — I/O is per CI, not per CA
Unit of allocationNo — space is allocated in CAsYes — CYLINDERS/TRACKS allocate CAs
Size specifiedCISZ in bytes (e.g. 4096, 8192)Derived from allocation (e.g. 1 cylinder per CA)
SplitsCI split: move records to free CI in same CACA split: allocate new CA, move ~half of CIs

In short: you read and write by CI; you allocate and extend by CA. When a KSDS or RRDS runs out of free space inside a CA, VSAM may perform a CA split (allocate a new CA and redistribute CIs). That is more expensive than a CI split (moving records within the same CA to a free CI).

How CAs Are Structured

A control area is simply a sequence of control intervals. There is no extra "CA header" in the same way there is a CIDF at the end of each CI. The CA is the space that holds those CIs. So the layout of the data component is: CA1 (CI1, CI2, …), CA2 (CI1, CI2, …), and so on. The number of CIs per CA is fixed when the cluster is created, based on the allocation unit (cylinder or track) and the CI size. Once the cluster is defined, that relationship does not change; only the contents of the CIs (records, free space) change as you insert, update, and delete.

For the index component of a KSDS, the same idea applies: the index is organized in index control intervals, and those index CIs are grouped into index control areas. Index CAs are also units of allocation for the index. When the index grows (for example after many key inserts and CI/CA splits), new index CAs may be allocated.

Space Allocation and CA Boundaries

VSAM always allocates space on control area boundaries. When you use DEFINE CLUSTER with CYLINDERS(primary secondary), VSAM allocates primary cylinders (and later secondary extents) and divides that space into CAs. The exact size of each CA in bytes depends on the device type (bytes per cylinder or per track) and the CI size. The high-allocated RBA (relative byte address) that VSAM maintains refers to the end of the allocated space—the total number of bytes in all allocated CAs. When a record is written into a CA for the first time, VSAM may format that entire CA (e.g. with binary zeros) before inserting logical records, so that the CA is properly initialized.

You do not specify "CA size" as a parameter. You specify:

  • CYLINDERS(n m) — primary n and secondary m cylinders. VSAM typically forms one CA per cylinder (or uses a standard relationship for the device).
  • TRACKS(n m) — primary n and secondary m tracks. Smaller allocation unit; more CAs with fewer CIs per CA.
  • RECORDS(n m) — space is computed from record count and record size; VSAM still organizes the space into CAs and CIs.

So the CA is the unit of allocation; the CI is the unit of I/O. LISTCAT and similar tools report allocation information (e.g. high-allocated RBA, high-used RBA) per component; the "allocation" is in terms of the space reserved for CAs.

FREESPACE and the CA Percentage

In DEFINE CLUSTER for KSDS and RRDS you can specify FREESPACE(ci-percent ca-percent). The first number is the percentage of each control interval to leave free for inserts. The second number is the percentage of each control area to leave free. The CA percentage does not mean "leave 10% of each CA empty" in the sense of blank bytes; it means that a certain percentage of the CIs in each CA are left available for use when a CI split happens. In other words, when you insert records and a CI fills up, VSAM can "split" that CI by moving some records to another CI in the same CA—but only if there is a free CI in that CA. The ca-percent in FREESPACE reserves that many CIs (or equivalent) per CA for such splits. If you set FREESPACE(20 10), you reserve 20% of each CI and 10% of each CA (as free CIs) so that CI splits can happen without immediately forcing a CA split.

If you set the CA percentage too low, you will run out of free CIs in a CA quickly. Then every time a CI would need to split, VSAM must do a CA split instead: allocate a new CA, move about half the CIs from the full CA to the new one, and update the index. CA splits involve many more I/Os than CI splits and can degrade performance. So the CA percentage in FREESPACE is a tuning parameter: enough free CIs per CA to absorb CI splits without constant CA splits, but not so much that you waste space. Typical values are in the range 5–20% for the CA component.

How Each Dataset Type Uses Control Areas

The way CAs are filled and used depends on the VSAM dataset type. The following table summarizes the behavior.

How dataset types use control areas
Dataset typeHow CAs are filled
KSDSCAs are not fully filled; FREESPACE(ci ca) reserves a percentage of each CA for inserts. Some CIs in a CA may be entirely free.
ESDSCAs are filled sequentially with CIs that contain records. No insert free space; records are appended at end.
RRDSCAs are filled with CIs containing fixed-length slots (active or empty). Empty slots are the “free space” for new records.

For ESDS there is no "insert" in the middle; records are appended at the end. So ESDS CAs are filled sequentially with no reserved free space. For LDS there are no records or CIs in the same sense; LDS is a byte stream. The CA concept applies mainly to KSDS and RRDS (and to the index component of KSDS), where inserts and deletes cause CI and CA splits.

CI Splits and CA Splits

When you insert a record into a KSDS, VSAM finds the correct control interval (in key order) and puts the record in that CI, using the free space. When the free space in that CI is exhausted and another record must go in the same key range, VSAM performs a CI split: it takes some records from the full CI and moves them to a free CI in the same control area. That way the new record can be placed in key order. A CI split requires reading the full CI, possibly reading the free CI, writing both CIs, and updating the index. It is more expensive than a simple in-CI insert but much cheaper than a CA split.

A CA split occurs when there is no free CI in the current CA to receive the records from a CI split. VSAM then allocates a new control area (using secondary allocation if needed), moves approximately half of the CIs from the full CA to the new CA, and updates the index so that key ranges point to the correct CA. After a CA split you have two CAs that are each about half full. CA splits are expensive: many reads and writes, index updates, and possibly extent allocation. You want to avoid frequent CA splits by specifying adequate FREESPACE(ci ca) at define time and, if the file grows a lot, by reorganizing periodically (REPRO to a new cluster with fresh free space).

So the hierarchy is: insert in free space inside a CI (cheapest); if CI is full, CI split to a free CI in the same CA (more expensive); if no free CI in the CA, CA split (most expensive). Good free space settings reduce how often you hit CA splits.

Defining a Cluster and CA Allocation

In DEFINE CLUSTER you control allocation and free space; you do not specify "CA size" explicitly. The following example shows typical parameters that affect CAs.

jcl
1
2
3
4
5
6
7
8
9
10
11
DEFINE CLUSTER ( - NAME(USERID.MASTER.KSDS) - INDEXED - RECORDSIZE(100 200) - KEYS(12 0) - FREESPACE(20 10) - CISZ(4096) - CYLINDERS(15 5)) - DATA (NAME(USERID.MASTER.KSDS.DATA)) - INDEX (NAME(USERID.MASTER.KSDS.INDEX))

Here CYLINDERS(15 5) allocates 15 primary cylinders (and 5 secondary). VSAM will format that space into control areas (typically one CA per cylinder). FREESPACE(20 10) reserves 20% of each CI and 10% of each CA for inserts. CISZ(4096) sets the CI size to 4 KB. The number of CIs per CA is derived from the cylinder size and 4096-byte CIs. So the CA is the allocation unit; the CI is the I/O unit; and FREESPACE(20 10) helps avoid excessive CI and CA splits as the file is loaded and updated.

High-Used RBA and Allocation

VSAM tracks how much of the allocated space is in use. The high-used RBA is the byte offset of the last used byte in the component. The high-allocated RBA is the total allocated size. So "high-used" tells you how much data has been written; "high-allocated" tells you how much space was allocated (in CA multiples). LISTCAT and similar reporting tools show these values under allocation information. When the high-used RBA approaches the high-allocated RBA, VSAM will use secondary allocation (if specified) to add more CAs. If you did not specify enough secondary space, the job may fail with a space-related error when the dataset tries to extend beyond the allocated extents.

Key Takeaways

  • A control area (CA) is a group of two or more control intervals. The data (and index) component is made up of one or more CAs.
  • The CI is the unit of I/O; the CA is the unit of space allocation. VSAM allocates on CA boundaries (e.g. one CA per cylinder).
  • CA size is not a direct parameter; it is derived from CYLINDERS/TRACKS and CISZ. You specify allocation and CI size; VSAM builds CAs from that.
  • FREESPACE(ci-percent ca-percent): the second number reserves a percentage of each CA (as free CIs) so that CI splits can occur without immediately triggering CA splits.
  • A CA split is expensive (new CA, move ~half the CIs, index update). Adequate FREESPACE and periodic reorganization help limit CA splits.

Explain Like I'm Five

Imagine a filing cabinet. Each drawer is a control area (CA). Inside each drawer you have folders in a row; each folder is a control interval (CI). When someone asks for a paper (record), the computer brings the whole folder (CI) to the desk. When the office needs more space, they add a whole new drawer (CA), and they might move some folders from a full drawer into the new one. The CA is "how we add space" (a whole drawer); the CI is "what we carry at once" (one folder). Leaving some empty folders in each drawer (FREESPACE) means we can rearrange papers without having to add a new drawer every time.

Test Your Knowledge

Test Your Knowledge

1. What is the unit of space allocation in VSAM?

  • Control interval
  • Control area
  • Single record
  • Track

2. When does a CA split occur?

  • When a CI is full
  • When there is no free CI in the CA for a CI split
  • When the key is duplicated
  • When the file is opened

3. What does the second number in FREESPACE(20 10) specify?

  • CI size in bytes
  • Percentage of free space in each control interval
  • Percentage of free space in each control area
  • Number of CAs
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