VSAM CI Splits

A control interval (CI) split is what happens when VSAM must insert a new record (or more data into an existing record) into a key-sequenced data set (KSDS) in key order, but the control interval where that record belongs has no free space left. Instead of rejecting the insert, VSAM creates room by moving about half of the records from that full CI to another CI in the same control area, then inserts the new record. The operation costs extra I/O and can slow down applications that do many inserts. Understanding exactly when and how CI splits occur helps you design and tune KSDS clusters (e.g. with FREESPACE and CISZ) so that splits are rare and performance stays good. This page explains what a CI split is, when it happens, the steps VSAM takes, how it affects performance, and how to reduce it.

What Is a CI Split?

In a KSDS, every record has a key and records are stored in key order. The data component is divided into control intervals; each CI holds several records plus free space (if you specified FREESPACE at define time). When you insert a new record, VSAM must place it in the correct CI so that key order is maintained. If that CI still has free space, the record is simply placed there and the free space is reduced. If that CI has no free space left, VSAM cannot put the record in without making room. A CI split is the process of making room: VSAM takes approximately half of the records from the full CI, moves them to a free CI in the same control area (CA), then inserts the new record in the appropriate CI so that key order is preserved. After the split, you have two CIs where before you had one full CI; both are updated and the index (sequence set and possibly index set) is updated to point to both CIs with the correct key ranges.

The "free CI" in the same CA exists because of the FREESPACE CA percentage. When you define the cluster with FREESPACE(ci-percent ca-percent), the second number reserves a proportion of each control area as free CIs. Those CIs are available to receive records when a CI split occurs. If there were no free CI in the CA, VSAM would have to perform a control area split first (allocate a new CA and move CIs), which is more expensive. So a CI split is the normal, within-CA way of handling a full CI on insert.

When Do CI Splits Occur?

CI splits occur only in key-sequenced data sets (and in practice when inserting into RRDS slot areas). They are triggered only by:

  1. Inserting a new record — The new record must go into a specific CI in key order. If that CI has no free space, a CI split is performed.
  2. Updating an existing record so it gets longer — For variable-length records, if the update increases the record length and the CI has no free space to hold the extra bytes, VSAM may need to split the CI to accommodate the expanded record.

The following do not cause CI splits: reading a record, deleting a record, or updating a record in a way that does not increase its length (or when the CI still has free space). Entry-sequenced data sets (ESDS) do not have CI splits because records are appended at the end of the file; there is no "insert in the middle" by key. Linear data sets (LDS) have no record structure, so there are no VSAM record inserts and no splits.

Actions and whether they can cause a CI split
ActionCan cause CI split?Notes
Insert new recordYesNew record must go in key order; if target CI is full, CI split occurs.
Update record (lengthen)YesVariable-length record that grows can require more space in the CI; if none left, split.
Read recordNoReads do not change data or free space.
Delete recordNoDelete frees space in the CI; it does not require a split.

Step-by-Step: How a CI Split Works

When an insert (or record expansion) triggers a CI split, VSAM follows a well-defined sequence. Understanding these steps helps you see why a single insert can result in multiple I/O operations and how the index stays consistent.

Steps in a CI split
StepDescription
Locate target CIVSAM finds the control interval that should contain the new record in key order.
Check free spaceIf the CI has free space, the record is inserted and no split occurs. If the CI is full, a split is triggered.
Find free CI in CAVSAM looks for a free (or largely empty) CI in the same control area, reserved by the FREESPACE CA percentage.
Move recordsApproximately half of the records in the full CI are moved to the free CI, preserving key order.
Insert new recordThe new record is placed in the correct CI (original or receiving) so that key order is maintained.
Update indexThe sequence set (and index set if needed) is updated so index entries point to both CIs with the correct key ranges.

After the split, the original CI holds roughly half of its former records plus the new record if it belongs there in key order; the other CI holds the rest. Both CIs are written back to disk, and the sequence set entries (and index set if the key range distribution changed) are updated so that key-based access can find records in either CI. From the application's point of view, the insert simply succeeds; the split is transparent but affects performance.

Example: CI Split in Action

Suppose you have a KSDS with 4KB control intervals and FREESPACE(20 10). One CI in control area CA-1 currently holds records with keys 101, 102, 103, 104, 105 and has used up all of its free space. You insert a new record with key 104 (or a key that sorts between 103 and 105). VSAM determines that this record belongs in this CI in key order, but the CI is full. So VSAM performs a CI split. It finds a free CI in CA-1 (e.g. CI-7). It moves the records with keys 104 and 105 from the full CI to CI-7. The original CI now contains 101, 102, 103 and has room. The new record is inserted in key order—for example if the new key is 103.5 it goes in the original CI; if 104.5 it goes in CI-7, which then holds 104, 104.5 (new), 105. The original CI keeps the lower keys and gains free space; the other CI holds the higher keys and the new record. The sequence set is updated so that one index entry points to the original CI (key range including 101–103) and another to CI-7 (key range including the new record and 104–105). Subsequent reads by key will use the index and find the record in the correct CI.

I/O and Performance Impact

A CI split is more expensive than a simple insert into a CI that has free space. When the target CI has room, VSAM may need to read that CI (if not already in the buffer), insert the record, and write the CI back—one read and one write, plus any index read/update. When a CI split occurs, VSAM must: read the full CI, read the free CI (or use an empty one), move records, write both CIs, and update the sequence set (and possibly the index set). So one logical insert can turn into several physical I/Os. If many inserts hit the same area of the file and free space is low, CI splits can occur repeatedly and throughput can drop. That is why FREESPACE is important: reserving 20–25% of each CI for inserts allows many records to be added before the CI fills and a split is needed. For files that are heavily updated after load, monitoring split activity (e.g. via SMF or LISTCAT) and ensuring adequate FREESPACE (or periodic REPRO to a new cluster with fresh free space) helps keep performance stable.

CI Split vs CA Split

A CI split uses a free CI within the same control area. A CA split occurs when a CI split is needed but there is no free CI in the current CA. In that case, VSAM must first allocate a new control area, move about half of the CIs from the full CA to the new CA, update the index, and then perform the CI split using the newly freed CIs in the original CA. So a CA split is a prerequisite when the CA has no free CIs; it is more expensive because it involves many CIs and index updates. The FREESPACE CA percentage (the second number in FREESPACE(ci ca)) reserves free CIs in each CA specifically so that CI splits can usually be satisfied within the CA and CA splits are less frequent.

How FREESPACE Reduces CI Splits

FREESPACE(ci-percent ca-percent) is specified at DEFINE CLUSTER time. The first number is the percentage of each control interval reserved for new or expanded records. For example FREESPACE(20 10) leaves 20% of each CI empty at load time. As you insert records, that space is consumed. With 20% free, a 4KB CI has roughly 800 bytes for inserts—enough for several records of typical size. So many inserts can be absorbed before the CI is full and a split is required. The second number (10%) reserves 10% of each control area as free CIs. When a CI does become full and a split is needed, that free CI is available in the same CA, so the split is a CI split rather than forcing a CA split. In practice, choosing FREESPACE(20 10) or (25 15) for files that grow after load keeps CI splits at a reasonable level; FREESPACE(0 0) fills every CI at load and makes the first insert in the middle of the file likely to cause a split.

Key Takeaways

  • A CI split occurs when a record must be inserted (or expanded) into a CI that has no free space. VSAM moves about half the records to a free CI in the same CA and inserts the new record in key order.
  • Only inserts and record expansion (variable-length) can trigger CI splits. Reads and deletes do not.
  • CI splits apply to KSDS (and RRDS when inserting into slots). ESDS and LDS do not have CI splits.
  • A CI split costs multiple I/Os: read full CI, write two CIs, update index. FREESPACE in the CI reduces how often splits occur.
  • The FREESPACE CA percentage reserves free CIs in each CA so that a CI split can complete without triggering a CA split.

Explain Like I'm Five

Imagine a row of boxes (CIs) on one shelf (CA). Each box has a label with the key range of the toys (records) inside. When you add a new toy, it has to go in the right box so the keys stay in order. If that box is full, you can't just stuff it in. So you take half the toys out of the full box and put them in an empty box on the same shelf. Now the first box has room and you put the new toy in the right box. That moving-half-to-another-box step is a CI split. Leaving some empty space in each box (FREESPACE) means you can add lots of toys before you have to do that.

Tutorial: When a CI Split Happens

To see the idea in code terms: when your program issues a WRITE or REWRITE that inserts or expands a record in a KSDS, the access method computes the target CI from the key. It checks whether that CI has enough free space. If yes, it places the record and updates the CI in the buffer; the CI is written back in due course. If no, it initiates a CI split: it obtains a free CI in the same CA (from the buffer pool or by reading one), moves records so that key order is maintained in both CIs, inserts the new record, writes both CIs, and updates the sequence set. Your program does not see the split; it only sees the successful completion of the write. The cost shows up in I/O and possibly in response time if splits are frequent.

Test Your Knowledge

Test Your Knowledge

1. What must be true for a CI split to occur?

  • The file is a KSDS
  • The target CI has no free space and a record is being inserted or expanded
  • The control area is full
  • You are doing a sequential read

2. Where do the moved records go during a CI split?

  • To a new control area
  • To a free CI in the same control area
  • To the end of the file
  • To the index component

3. Which VSAM type does not have CI splits?

  • KSDS
  • RRDS
  • ESDS
  • None
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