Mainframe Path Start learning free
Core7 min readLesson 3 of 4

Catalogs: how a name becomes a location

You refer to a dataset by name, and the system finds it without you saying which disk it is on. That indirection is the catalog. Understanding it explains a whole family of otherwise baffling errors.

The two-level structure

Resolving PROD.PAY.MASTER
The namePROD.PAY.MASTER
Master catalogFinds an alias for PROD
User catalogHolds the entry for this dataset
VolumeWhich disk, and where on it

The errors this explains

SymptomWhat it usually means
Dataset not found, but you can see it in 3.4You are looking at an uncatalogued dataset found by volume, not by catalog
NOT IN CATALOG on a job that ran yesterdayA previous step deleted it, or a rerun's delete step removed it
Duplicate dataset name on allocationA catalog entry exists for a dataset that was deleted without being uncatalogued
A new HLQ cannot be allocatedNo alias exists for it, so the system does not know which user catalog to use

IDCAMS: the tool for all of this

The catalog commands you will actually use
//STEP010  EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  LISTCAT ENT('PROD.PAY.MASTER') ALL
  LISTCAT LVL('PROD.PAY')
  DELETE  'PROD.PAY.OLD'
  DELETE  'PROD.PAY.GHOST' NOSCRATCH   <- catalog entry only
  DEFINE  NONVSAM(NAME('PROD.PAY.RECOV') -
                  DEVT(3390) VOL(DASD01))     <- recatalog
  SET MAXCC=0
/*

Generation data groups

A GDG is a catalog construct: one name that stands for a series of generations. You refer to them relatively, which is what makes daily jobs rerunnable without editing JCL.

ReferenceMeans
MYGDG(0)The current, most recent generation
MYGDG(-1)The previous one
MYGDG(+1)A new one, created by this job
MYGDG.G0042V00An absolute generation, if you need to be specific

Common mistakes

Using (0) instead of (+1) later in the same job

You will silently process the previous generation. The job succeeds and the output is wrong, which is worse than an abend.

Deleting a dataset outside the catalog

Leaves an orphan entry that blocks the next allocation with a duplicate-name error.

Assuming NOT IN CATALOG means the data is gone

Often the data is still on the volume; only the catalog entry was removed. It can usually be recatalogued.

What you will see at work

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
← Sequential, partitioned, and the restThe utilities that move data around →