MainframeMaster

IDCAMS DEFINE CLUSTER generator

Fill in the cluster type, name, record size, key (for KSDS), and space. You get DEFINE CLUSTER control cards, optional DELETE for recreate jobs, and a minimal IDCAMS JCL wrapper you can paste into your shop after changing CLASS, MSGCLASS, and account.

How to use it

  1. Pick a preset (KSDS 80 is the usual lab starter) or choose KSDS / ESDS / RRDS yourself.
  2. Set NAME, RECORDSIZE, and for KSDS the KEYS length and offset.
  3. Choose CYLINDERS, TRACKS, or RECORDS for primary and secondary. Leave VOLUMES blank under SMS.
  4. Turn on DELETE if this is a recreate job. Copy the JCL, then fix CLASS / MSGCLASS / ACCT for your site.

Runs in your browser. Nothing is uploaded.

IDCAMS DEFINE CLUSTER generator

Presets
Inputbytes
Inputbytes
Inputbytes
Inputbytes
Inputcyl
Inputcyl
Input%
Input%

Check these

  • VOLUMES omitted. Fine under SMS; non-SMS shops usually need VOLUMES(volser).
  • DELETE runs first. IF LASTCC=8 SET MAXCC=0 treats "not found" as OK so DEFINE can continue.

KSDS → INDEXED · full JCL

//IDCDEF JOB (ACCT),'DEFINE CLUSTER',CLASS=A,MSGCLASS=X
//*
//* Generated by MainframeMaster IDCAMS DEFINE CLUSTER tool
//* Change CLASS/MSGCLASS/ACCT for your shop. Review VOLUMES for SMS.
//*
//STEP010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DELETE USER.DEMO.KSDS CLUSTER PURGE
  IF LASTCC = 8 THEN SET MAXCC = 0
  DEFINE CLUSTER ( -
    NAME(USER.DEMO.KSDS) -
    INDEXED -
    RECORDSIZE(80 80) -
    KEYS(10 0) -
    FREESPACE(20 10) -
    CYLINDERS(5 1) -
    SHAREOPTIONS(2 3) -
    NOREUSE) -
  DATA (NAME(USER.DEMO.KSDS.DATA)) -
  INDEX (NAME(USER.DEMO.KSDS.INDEX))
/*

Need this at work?

Free account saves tutorial progress. The jobs board lists openings that ask for JCL.

VSAM / JCL jobs on the board

SHAREOPTIONS explained

SHAREOPTIONS(cross-region cross-system) controls who can open the cluster at the same time, and whether VSAM keeps buffers honest when more than one user is in. You code two numbers. The first is sharing inside one z/OS image (multiple jobs, CICS regions, TSO users). The second is sharing across systems in a sysplex (or loosely coupled systems that share the DASD).

This tool offers the usual presets. Match whatever your shop already uses on similar files; wrong share options show up as open failures, stale reads, or overlayed updates.

Cross-region (first number)

  • 1: Fully shared for read and write. VSAM does not protect integrity. Your application (or ENQ/RESERVE) has to stop two updaters from stomping each other.
  • 2: Many readers, at most one writer. VSAM serializes the writer. Common for batch files that one job updates while others browse.
  • 3: Fully shared. VSAM refreshes buffers so each request sees current data. Heavier than 2; used when several regions really update the same cluster.
  • 4: Like 3, with buffer refresh on every direct request. Even more conservative. Rare outside shops that already standardized on it.

Cross-system (second number)

  • 1: Shared across systems with no VSAM cross-system integrity. You own the locking story.
  • 2: Reserved. Do not code it.
  • 3: Shared across systems with VSAM write-integrity checks (needs GRS or equivalent). The usual second number on production DEFINE cards.
  • 4: Like 3, plus stronger buffer invalidation across systems. Use when your standards say so; otherwise 3 is enough.

Presets in this tool

  • (2 3): Batch default in a lot of shops. One updater per image, many readers, cross-system integrity on.
  • (1 3): Full share inside the image; your code (or CICS/file control) must serialize updates. Cross-system still uses 3.
  • (3 3): Full VSAM-managed sharing in-image and across systems. Pick this when multiple updaters are real, not theoretical.

FREESPACE CI and CA

FREESPACE(ci-percent ca-percent) reserves empty room when VSAM loads or splits space, so later inserts do not split as often. It matters on KSDS and RRDS. ESDS mostly appends, so this generator skips FREESPACE for ESDS.

CI percent (first number)

A control interval (CI) is the unit VSAM reads and writes (often 4K or so). The CI percent is how much of each CI to leave empty when the file is loaded. Example: FREESPACE(20 10) leaves about 20% of every CI free. Inserts that land in that CI can use the hole instead of forcing a CI split right away.

Higher CI free space means fewer splits during random inserts, and fewer records packed per CI, so sequential reads do more I/O. Low or zero CI free space packs tight; fine for load-once / read-mostly files, painful if you insert into the middle of a KSDS all day.

CA percent (second number)

A control area (CA) is a group of CIs (often a cylinder's worth). The CA percent is how many CIs in each CA to leave completely empty at load. With FREESPACE(20 10), about 10% of the CIs in each CA stay empty. Those empty CIs absorb growth before VSAM has to split a whole CA (a much bigger, slower event than a CI split).

Typical starter values sit around 10–30 for CI and a bit lower for CA (for example 20 10 or 15 5). Tune from LISTCAT split counts after the file has real traffic. Empty FREESPACE(0 0) is normal for files you load sorted and almost never insert into.

What the output is

  • DEFINE CLUSTER: the control cards IDCAMS reads from SYSIN. Organization keyword is INDEXED, NONINDEXED, or NUMBERED based on the type you picked.
  • DELETE prefix (optional): removes an existing cluster so DEFINE can recreate it. The LASTCC=8 guard keeps a missing cluster from failing the job.
  • Sample JCL: JOB, EXEC PGM=IDCAMS, SYSPRINT, and SYSIN wrapped around those cards.

Parameter cheat sheet

  • NAME: cluster name in the catalog (up to 44 characters). Programs and JCL open this name.
  • RECORDSIZE(min max): allowed record lengths. Fixed files use the same number twice, e.g. RECORDSIZE(80 80).
  • KEYS(length offset): KSDS only. Length and 0-based start of the key. Cannot change after define.
  • FREESPACE(ci ca): percent empty space in each CI and CA for inserts (KSDS / RRDS).
  • CYLINDERS / TRACKS / RECORDS: primary then secondary allocation.
  • SHAREOPTIONS: how regions and systems may share the file. (2 3) is a common batch default.
  • CISZ: optional control interval size. Blank lets IDCAMS choose.
  • REUSE: allow rewrite without deleting first. NOREUSE is the usual default.

Sample KSDS (what a preset looks like)

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//IDCDEF JOB (ACCT),'DEFINE CLUSTER',CLASS=A,MSGCLASS=X //* //STEP010 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE USER.DEMO.KSDS CLUSTER PURGE IF LASTCC = 8 THEN SET MAXCC = 0 DEFINE CLUSTER ( - NAME(USER.DEMO.KSDS) - INDEXED - RECORDSIZE(80 80) - KEYS(10 0) - FREESPACE(20 10) - CYLINDERS(5 1) - SHAREOPTIONS(2 3) - NOREUSE) - DATA (NAME(USER.DEMO.KSDS.DATA)) - INDEX (NAME(USER.DEMO.KSDS.INDEX)) /*

Explain it like I'm 5

DEFINE CLUSTER is ordering a new filing cabinet. You say whether it has keys (KSDS), just stacked papers (ESDS), or numbered drawers (RRDS), how big each folder is, how much shelf space you want, and what to call it. The system finds disk space, writes the name in the catalog, and then programs can open that name.

FAQ

Related Pages

More detail

The DEFINE CLUSTER tutorial walks every parameter with examples. IDCAMS job structure is in the IDCAMS utility page. Other calculators live on /tools.