Defining a KSDS is one of the first “I am a real mainframer” tasks you will own end to end. It is also easy to do dangerously fast: a copied DEFINE from the internet, a rushed KEYS clause, and suddenly a catalog entry exists that training LPARs tolerate but production RACF never allows. This page is a twelve-step recipe that forces sequencing: understand the record, choose space, write DEFINE with explicit component names for clarity, review with a human, submit IDCAMS, LISTCAT verify, wire security, optionally REPRO load, smoke test, document, and hand off. Adapt numbers to your standards; do not adapt the ordering if you are still learning.
| Step | What to do |
|---|---|
| 1. Record contract | LRECL/maximum record, RECFM if sequential source, key offset/length, duplicate policy. |
| 2. Space story | Primary/secondary in CYL or TRK; expected rows; growth percent; volumes or SMS classes per policy. |
| 3. CI/CA tuning first pass | Pick initial CI and CA sizes from standards; schedule measurement after representative load. |
| 4. Author DEFINE | NAME, INDEXED, KEYS, RECORDSIZE, SHAREOPTIONS, FREESPACE, DATA, INDEX, CATALOG as required. |
| 5. Peer review | Second person reads NAMES, volumes, and KEYS line slowly out loud. |
| 6. Submit IDCAMS | Capture SYSPRINT; treat warnings as work items, not noise. |
| 7. LISTCAT ALL | Confirm components, volumes, attributes, and unexpected SMS overrides. |
| 8. Security | RACF profiles for cluster/components; CICS or batch IDs granted consistently. |
| 9. Optional REPRO load | Sort keyed input ascending; run REPRO; reconcile counts. |
| 10. Smoke OPEN | Tiny read program or utility validates path end-to-end. |
| 11. Change record | Attach SYSPRINT and LISTCAT to the ticket; note rollback DELETE steps. |
| 12. Handoff | Developers receive DSN, DISP expectations, FILE STATUS notes, and reorg owner. |
Replace every name, volume, and size with values your storage team approved. KEYS(10 0) means length ten starting at displacement zero in the logical record per IBM convention—confirm against your layout; many production keys are not at zero.
12345678910111213141516171819//DEFKSDS EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE CLUSTER (NAME(DEPT.TRAIN.CUST.KSDS) - INDEXED - KEYS(10 0) - RECORDSIZE(80 80) - CYLINDERS(2 1) - FREESPACE(10 5) - SHAREOPTIONS(2 3) - VOLUMES(SCR001)) - DATA (NAME(DEPT.TRAIN.CUST.KSDS.DATA)) - INDEX (NAME(DEPT.TRAIN.CUST.KSDS.INDEX)) /* //CHKLIST EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * LISTCAT ENTRIES(DEPT.TRAIN.CUST.KSDS) ALL /*
Minimum and maximum logical lengths must bracket every record you will store. Variable-length KSDS records use a four-byte RDW-style length prefix in many language mappings; beginners miscount that prefix and set maximum too small. Walk the layout with hex documentation if needed.
The pair expresses how VSAM allows sharing across systems and regions. Wrong values cause intermittent locking failures or, worse, unsafe sharing. CICS and batch combinations have opinions; copy from a known-good pattern at your shop instead of inventing numbers.
If your enterprise uses user catalogs, the CATALOG operand or alias strategy determines where the entry lands. Wrong catalog placement makes LISTCAT searches feel “flaky” because you are looking in the master while the object lives elsewhere.
LISTCAT ALL is your photograph of reality. Compare KEYS, RECORDSIZE, volumes, and free space to the design document. If anything drifted because SMS ignored a mistyped DATACLAS, you want that discovery before REPRO loads ten million rows.
If you will populate immediately, queue the SORT job before REPRO as described on the initial load page. Keep define and load in separate steps during learning so you can separate catalog mistakes from data mistakes when SYSPRINT complains.
Building a KSDS is like building a labeled drawer cabinet before you put toys inside. You measure toys first, print labels the same size as the measuring tape says, screw the cabinet to the wall where parents allow, then take a photo for the grown-ups’ binder—that is LISTCAT. Only after the cabinet is solid do you sort toys by label and put them in—that is REPRO. If you skip measuring, the dinosaur tail sticks out and the drawer jams forever.
1. Which pair must be true before DEFINE succeeds for a KSDS?
2. Why peer-review NAMES out loud?
3. Immediately after DEFINE, which command proves the catalog view?