When you run it, it inspects the catalog records, comparing the expiry date of the dataset against the check date (usually the current date). Any datasets that have an expiry date less than the check date are processed for removal. If a dataset does not have an expiry date, it is not removed.
You can limit the datasets considered for removal by passing a high level qualifier as a parameter to the MFCATMNT program; for example, the sample job below will only check datasets that begin with 'MFI101':
//CATMNT1 JOB 'CATALOG MAINTENANCE',CLASS=A, // MSGCLASS=X,MSGLEVEL=(1,1), // REGION=0M //* ========================================================= //* Drive the catalog maintenance utility for MFI101 datasets //* ========================================================= //MFCATMNT EXEC PGM=MFCATMNT, // PARM='MFI101' //SYSOUT DD SYSOUT=*
The process scans the catalog, looking for datasets that begin with 'MFI101'. For each one that it finds, it will attempt to allocate the dataset to the current job and ENQ it. This ensures that the dataset is not in use by another process at the time the check takes place. If the process cannot ENQ a dataset, it skips over that dataset and moves to the next one. Once enqueued, the expiry date is checked against the check date: if the dataset should be deleted, it is deallocated and deleted; otherwise, it is deallocated and kept.
Datasets that are deleted by the process are reported in the SYSOUT file assigned to the step.
You can also use the special job extension %CATMAINT in a JCL job step to perform catalog maintenance; see JOB Statement Extensions for more information on the required syntax.