DELETE
Removes a dataset, or one member of a library, for good.
Also written DEL
Why it matters. Jobs often stop because an old copy of a file is still there. DELETE clears the way, so you need to use it with care.
Syntax
{DELETE | DEL} entry-name[/password] [PURGE | NOPURGE] [SCRATCH | NOSCRATCH] [CLUSTER | NONVSAM | ALIAS | GDG]
DELETE 'dsname(member)'- entry-name
- The dataset to delete. Quote it.
- 'dsname(member)'
- Delete one member and leave the library.
- PURGE
- Delete even if the retention period has not ended. It has nothing to do with the job queue.
- SCRATCH | NOSCRATCH
- SCRATCH (the default) removes a non-VSAM dataset from the disk as well as the catalog. NOSCRATCH leaves it on the disk.
- CLUSTER
- Say the entry is a VSAM cluster.
- NONVSAM
- Say the entry is an ordinary dataset.
- CATALOG(name)
- Delete from this catalog.
- ERASE
- For VSAM: overwrite the data with zeros as it is deleted.
Try it DELETE
- 1
The old dataset ZB0001.DEV.OLDWORK is not needed any more. Delete it.
DELETE 'ZB0001.DEV.OLDWORK' - 2
The library ZB0001.DEV.JCL has an old member, OLDNOTES. Delete only that member. Keep the rest of the library.
DELETE 'ZB0001.DEV.JCL(OLDNOTES)' - 3
Run the first delete again, for ZB0001.DEV.OLDWORK. See what happens when it is already gone.
DELETE 'ZB0001.DEV.OLDWORK'
Remember
- A member in brackets removes one member. No brackets removes the whole dataset.
- There is no undo. Check the name first.
- LASTCC=8 means the delete failed.
The usual mistake
DELETE 'ZB0001.DEV.JCL'
You meant to remove one member, but without brackets this removes the whole library and every member in it.
DELETE 'ZB0001.DEV.JCL(OLDNOTES)'
On real z/OS
The messages are the IDCAMS messages real TSO prints. MF/OS reads the dataset name and PURGE, and does not model the other operands. On a real system, the + after IDC3012I shows that a second-level message (IDC3009I) is hidden until you type ?.
Where can I practise DELETE?
Right here, at ZedBank. You take a junior job at a simulated bank and use DELETE in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- DatasetWhat a mainframe calls a file: a named collection of records with a defined structure, rather than a loose stream of bytes.
- Partitioned datasetA dataset that works like a library or folder, holding many separately named members inside one dataset.
- MemberOne named item inside a partitioned dataset, such as a single program, job or copybook within a library.
- CatalogThe system's index of where datasets live, so you can refer to a dataset by name without knowing which disk it is on.
- Return codeA number a program leaves behind saying how it went. Zero for clean, higher numbers for warnings and failures.