IDCAMS
The utility that makes, lists, copies and deletes datasets. It is the tool for VSAM.
Also written access method services, AMS
Why it matters. When a dataset is the thing you work on, not its contents, you use IDCAMS. It also finds out what the catalog knows.
See it
IDCAMS manages VSAM datasets and catalogue entries.
Syntax
//STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * command ... (ended by /*)
- DEFINE
- Make a cluster, GDG, alias and more.
- LISTCAT
- List catalog entries.
- REPRO
- Copy records.
- List records.
- DELETE
- Remove an entry.
- SET MAXCC / IF LASTCC
- Change or test the condition code.
Try it LISTCAT
- 1
You're in the SYSIN lines of job LISTJOB, under EXEC PGM=IDCAMS. Write the command that lists the catalog entries that start with ZBANK.DATA.
SYSIN LISTCAT LEVEL(ZBANK.DATA) - 2
Submit the job LISTJOB from your DEV JCL library.
SUBMIT 'ZB0001.DEV.JCL(LISTJOB)' - 3
Read what IDCAMS printed, STEP1.SYSPRINT.
OUTPUT LISTJOB STEP1.SYSPRINT
Remember
- IDCAMS works on datasets themselves: DEFINE, LISTCAT, REPRO, PRINT, DELETE.
- Its commands go in SYSIN. Its answers come back on SYSPRINT.
- The last line gives the highest condition code.
The usual mistake
Putting a LISTCAT line in a job with EXEC PGM=IEFBR14
IEFBR14 does nothing. It never reads the line. Only IDCAMS understands IDCAMS commands.
//STEP1 EXEC PGM=IDCAMS, with the command in SYSIN
On real z/OS
MF/OS supports LISTCAT, DEFINE CLUSTER, DEFINE GDG, REPRO, PRINT and DELETE, and refuses the rest with a Mainframe101 sim: line. In a job, its LISTCAT prints a layout of its own with a HISTORY block; real LISTCAT prints just the type, name and catalog for each entry unless you add ALL or HISTORY. A real DELETE of a missing entry also prints IDC3009I with a catalog reason code.
Where can I practise IDCAMS?
Right here, at ZedBank. You take a junior job at a simulated bank and use IDCAMS in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- 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.
- KSDSThe most common VSAM dataset type, where every record has a unique key used to find it directly.
- Utility programA supplied program that performs a standard job such as copying, sorting, comparing or managing datasets, driven by control statements.
- 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.