DEFINE CLUSTER
Creates a VSAM file with a name, a kind and a key.
Also written DEFINE, DEF CLUSTER
Why it matters. The account master is a keyed file. Nothing can be loaded into it until DEFINE CLUSTER has built it.
See it
A cluster is a VSAM dataset: the data and its index together.
Syntax
DEFINE CLUSTER (NAME(entry) INDEXED KEYS(length offset) RECORDSIZE(average maximum) TRACKS(primary secondary)) DEFINE CLUSTER (NAME(entry) NONINDEXED ...) | (NAME(entry) NUMBERED ...)
- NAME
- The name of the cluster.
- INDEXED
- Makes a KSDS. NONINDEXED makes an ESDS. NUMBERED makes an RRDS.
- KEYS(length offset)
- How long the key is, and where it starts. Offset 0 is the first byte.
- RECORDSIZE(avg max)
- The average and largest record length.
- TRACKS / CYLINDERS
- The space: first amount, then how much to add.
- VOLUMES
- The disk volume. A storage-managed system can pick one for you.
- FREESPACE(ci ca)
- Percent of space left empty in each block and area, for later inserts.
Try it DEFINE CLUSTER
- 1
You're in the SYSIN lines of job MKMAST, under EXEC PGM=IDCAMS. Write the command that creates the keyed file ZBANK.DATA.ACCTMAST, with an 8 character key from the start, records of 80, and 1 track to begin with. Type it on one line.
SYSIN DEFINE CLUSTER (NAME(ZBANK.DATA.ACCTMAST) INDEXED KEYS(8 0) RECORDSIZE(80 80) TRACKS(1 1)) - 2
Submit the job MKMAST from your DEV JCL library.
SUBMIT 'ZB0001.DEV.JCL(MKMAST)' - 3
Read the output of the job.
OUTPUT MKMAST
Remember
- DEFINE CLUSTER builds a VSAM file. It is an IDCAMS command.
- INDEXED with KEYS(length offset) makes a keyed file.
- A name that already exists fails with IDC3013I.
The usual mistake
Run MKMAST twice
The second time, ZBANK.DATA.ACCTMAST is already in the catalog. DEFINE stops with IDC3013I DUPLICATE DATA SET NAME.
Delete the old cluster first, then run MKMAST again
On real z/OS
MF/OS keeps the key length and the record size, but not the other VSAM details such as control interval size, spare space or the volume. If you leave out RECORDSIZE, MF/OS uses 80, where real IDCAMS uses 4089 for both values. The key you give is checked when the cluster is defined and then forgotten; real VSAM keeps it in the catalog and checks it when a program opens the file. IDC0508I and IDC0509I allocation lines are shown as on z/OS, but the disk volume is always RES001.
Where can I practise DEFINE CLUSTER?
Right here, at ZedBank. You take a junior job at a simulated bank and use DEFINE CLUSTER in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- IDCAMSThe utility used to create, list, copy and delete datasets, and the standard tool for anything involving VSAM.
- KSDSThe most common VSAM dataset type, where every record has a unique key used to find it directly.
- VSAMA family of dataset types built for fast record access by key, used where applications need to look records up rather than read them in order.
- Job stepOne program execution within a job. A job is simply a sequence of steps that run in order.
- CatalogThe system's index of where datasets live, so you can refer to a dataset by name without knowing which disk it is on.
- DatasetWhat a mainframe calls a file: a named collection of records with a defined structure, rather than a loose stream of bytes.