VSAM CA Splits

A control area (CA) split is what happens when VSAM needs to perform a control interval (CI) split—because you inserted a record or expanded one and the target CI is full—but the current control area has no free CI left to receive the records that must be moved. In that case, VSAM cannot do the CI split until it creates free CIs. It does that by allocating a new control area, moving approximately half of the CIs from the full CA to the new CA, and then performing the CI split using the freed CIs in the original CA. CA splits are more expensive than CI splits because they involve many more I/Os and index updates. Understanding when and how CA splits occur helps you set FREESPACE and plan for growth so that CA splits are rare. This page explains what a CA split is, when it happens, the steps involved, and how to minimize it.

What Is a CA Split?

In a KSDS, the data component is organized into control areas; each CA contains multiple control intervals. When you insert a record, VSAM may need to split a full CI by moving half of its records to another CI in the same CA. That other CI must exist and be free—that is what the FREESPACE CA percentage provides. If every CI in the CA is in use (full or already used in prior splits), there is no free CI for the next CI split. A CA split is the process of creating free CIs: VSAM allocates a new control area (from the cluster's allocated space), moves about half of the CIs from the full CA to the new CA, and updates the index so that both CAs are correctly referenced. After the move, the original CA has empty CIs. VSAM then performs the CI split within the original CA using one of those free CIs and completes the insert. So a CA split is a prerequisite step when the CA has run out of free CIs; it is not a substitute for a CI split but what makes the CI split possible.

When Do CA Splits Occur?

A CA split occurs only when both of the following are true:

  1. A CI split is needed — You inserted a new record or expanded an existing one, and the CI where the record must go in key order has no free space.
  2. There is no free CI in the current control area — All CIs in that CA are in use (filled with records or already used in previous CI splits). The FREESPACE CA percentage reserves some CIs as free; when those are exhausted, the next CI split cannot complete without first creating free CIs, which triggers the CA split.

So CA splits are less frequent than CI splits. Every CA split is preceded by the need for a CI split; but many CI splits are satisfied within the CA because free CIs are available. Only when the CA has no free CIs does a CA split occur. That is why the second number in FREESPACE(ci-percent ca-percent) matters: a non-zero CA percentage (e.g. 10 or 15) reserves free CIs in each CA and delays or avoids CA splits until the file has grown and those free CIs have been used.

Step-by-Step: How a CA Split Works

Steps in a CA split
StepDescription
CI split neededAn insert or record expansion requires a CI split, but the target CA has no free CI.
Allocate new CAVSAM allocates a new control area from the space allocated to the cluster (primary or secondary).
Move CIsApproximately half of the control intervals in the full CA are moved to the new CA, preserving key order across CIs.
Free CIs in original CAThe original CA now has free CIs that were vacated by the move.
Perform CI splitVSAM performs the CI split using a free CI in the original CA and inserts the new record.
Update indexSequence set and index set are updated so the new CA is indexed and key ranges point to the correct CIs in both CAs.

The result is that the original CA now has roughly half the CIs it had (the others are in the new CA), so it has free space for the CI split. The new CA is formatted and filled with the moved CIs. The sequence set and index set are updated so that key-based access can find records in either CA. From the application's perspective, the insert completes successfully; the cost is in the extra I/O and possible latency when CA splits happen.

CA Split vs CI Split

Comparing CI split and CA split
AspectCI splitCA split
TriggerFull CI; insert or expandCI split needed but no free CI in CA
New spaceUses existing free CI in same CAAllocates new control area
What movesAbout half the records in one CIAbout half the CIs in the CA
I/O costRead/write 2 CIs + indexMany CI reads/writes + new CA + index at multiple levels

In practice, you want most splits to be CI splits (within the same CA) and CA splits to be rare. That is achieved by specifying adequate FREESPACE: both a CI percentage (so CIs do not fill too fast) and a CA percentage (so each CA has free CIs for CI splits). For files that grow a lot after initial load, values like FREESPACE(25 15) or (20 10) are common. If you use FREESPACE(20 0), you have no reserved free CIs in each CA; the first time a CI in that CA needs to split, a CA split will occur.

Performance Impact

A CA split is one of the most expensive operations in VSAM. It requires: allocating a new control area (which may involve extending the dataset if secondary space is used), reading many CIs from the full CA, writing them to the new CA, updating the original CA (freed CIs), performing the CI split (read/write two CIs), and updating the sequence set and index set so that the new CA and the new key distribution are reflected. For large CAs (e.g. many CIs per CA), the number of I/Os can be substantial. Applications that do heavy random insert activity may see occasional spikes in response time when a CA split occurs. Reducing CA splits by setting a reasonable FREESPACE CA percentage and by monitoring growth (e.g. high-used RBA vs allocated) helps keep performance predictable. For very dynamic files, periodic reorganization (REPRO to a new cluster with the same or higher FREESPACE) can restore free space and reduce the chance of CA splits.

How FREESPACE Reduces CA Splits

FREESPACE(ci-percent ca-percent) has two roles. The first (CI percentage) reserves space inside each CI for inserts, so CIs do not fill up too quickly and CI splits are less frequent. The second (CA percentage) reserves a proportion of each control area as free CIs. Those free CIs are not filled at load time; they are left available. When a CI in that CA becomes full and a CI split is needed, VSAM uses one of these free CIs to receive the records that are moved. So the CI split completes within the same CA and no CA split is required. Only after all the free CIs in the CA have been used (by repeated CI splits) will the next CI split force a CA split. So a non-zero CA percentage (e.g. 10 or 15) directly reduces how often CA splits occur. A zero CA percentage means there are no reserved free CIs; the first CI split in each CA will trigger a CA split.

Key Takeaways

  • A CA split occurs when a CI split is needed but there is no free CI in the current control area. VSAM allocates a new CA, moves about half the CIs to it, then performs the CI split.
  • CA splits are more expensive than CI splits: more I/O, more index levels updated, and new space allocation.
  • The FREESPACE CA percentage reserves free CIs in each CA so that CI splits can usually complete without a CA split. Use a non-zero value (e.g. 10 or 15) for files that grow after load.
  • CA splits apply only to KSDS (and RRDS when inserting into full slot areas). ESDS and LDS do not have CA splits.

Explain Like I'm Five

Imagine one shelf (CA) with several boxes (CIs). When a box is full and you need to add a toy, you take half the toys to an empty box on the same shelf—that's a CI split. But what if the shelf has no empty box? Then you have to get a new shelf, move half the boxes to the new shelf, and now the first shelf has empty boxes. Then you can do the "move half the toys" step on the first shelf. Getting the new shelf and moving the boxes is a CA split. Leaving some empty boxes on each shelf (FREESPACE CA) means you usually don't need a new shelf.

Test Your Knowledge

Test Your Knowledge

1. When is a CA split required?

  • Whenever a CI is full
  • When a CI split is needed but there is no free CI in the current CA
  • When you delete a record
  • When the file is opened

2. What does the second number in FREESPACE(20 10) do for CA splits?

  • Reserves 10% of each CI
  • Reserves 10% of each CA as free CIs so CI splits can happen without a CA split
  • Reserves 10 CAs
  • Limits splits to 10

3. Which is more expensive: CI split or CA split?

  • CI split
  • CA split
  • They are the same
  • Depends on key length
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