LISTDS
Shows the attributes of one dataset.
Also written LISTD
Why it matters. Before you edit or copy a dataset, LISTDS tells you its shape and what is inside.
Syntax
LISTDS ('dsname' ...) [MEMBERS] [STATUS] [HISTORY] [LABEL]
LISTDS ('high-level-qualifier') LEVEL- 'dsname'
- The dataset to describe. A name in quotes is used as typed. One * can stand for one qualifier.
- MEMBERS
- Also list the member names of a library, including aliases.
- STATUS
- Also show the file name (ddname) and disposition the dataset has right now.
- HISTORY
- Also show the creation and expiry dates, and whether RACF protects it.
- LABEL
- Show the whole dataset control block (DSCB) in hexadecimal.
- LEVEL
- Treat the name as a high-level qualifier and list every cataloged dataset under it.
Try it LISTDS
- 1
Show the attributes of ZB0001.DEV.JCL.
LISTDS 'ZB0001.DEV.JCL' - 2
Show the members inside it too.
LISTDS 'ZB0001.DEV.JCL' MEMBERS - 3
Ask about a dataset that doesn't exist: ZB0001.NO.FILE.
LISTDS 'ZB0001.NO.FILE'
Remember
- LISTDS shows attributes, not the contents.
- Add MEMBERS to list a library's members.
- Quote the name, so TSO doesn't add your prefix.
The usual mistake
LISTDS ZBANK.DATA.CUSTOMER
Without quotes, TSO adds your prefix to the front. It looks for ZB0001.ZBANK.DATA.CUSTOMER, which isn't there.
LISTDS 'ZBANK.DATA.CUSTOMER'
On real z/OS
MF/OS prints the real headings for STATUS and HISTORY, but LABEL prints a note instead of the control block, and LEVEL is not modelled. The MF/OS terminal also prints a hint line under a library, '(add MEMBERS to list the members)'; real LISTDS does not, so this page leaves it out.
Where can I practise LISTDS?
Right here, at ZedBank. You take a junior job at a simulated bank and use LISTDS 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.
- CatalogThe system's index of where datasets live, so you can refer to a dataset by name without knowing which disk it is on.
- 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.
- TSOTime Sharing Option: the interactive login environment on z/OS, where you get a command prompt and a session of your own.