Lists the records in a file, including a VSAM file.
Also written IDCAMS PRINT
Why it matters. BROWSE cannot open a keyed file. PRINT is how you check what is really in the account master.
Syntax
PRINT INDATASET(entry) [CHARACTER|HEX|DUMP] [COUNT(n)] [SKIP(n)] PRINT INFILE(ddname) ...
- INDATASET
- The file to list.
- CHARACTER
- Show the records as text.
- HEX / DUMP
- Show hexadecimal, or hex with text beside it.
- COUNT(n)
- Stop after n records.
- SKIP(n)
- Start after the first n records.
- FROMKEY / TOKEY
- List only a range of keys in a KSDS.
Try it PRINT
- 1
List the first 5 records of the account master, ZBANK.DATA.ACCTMAST, as text.
PRINT INDATASET('ZBANK.DATA.ACCTMAST') CHARACTER COUNT(5) - 2
Now skip the first record and show only the next two.
PRINT INDATASET('ZBANK.DATA.ACCTMAST') CHARACTER SKIP(1) COUNT(2) - 3
Try a name with a typo: ZBANK.DATA.ACCTMST.
PRINT INDATASET('ZBANK.DATA.ACCTMST') CHARACTER
Remember
- PRINT INDATASET('name') lists a file's records.
- CHARACTER shows text. COUNT(n) and SKIP(n) pick the part.
- BROWSE cannot open a keyed file. PRINT can.
The usual mistake
BROWSE 'ZBANK.DATA.ACCTMAST'
BROWSE is for ordinary files and members. A keyed VSAM file is a different kind of file, and BROWSE cannot open it.
PRINT INDATASET('ZBANK.DATA.ACCTMAST') CHARACTER COUNT(5)
On real z/OS
Real PRINT shows a KEY OF RECORD line before each record of a keyed file, and prints IDC3009I with the catalog return code after IDC3012I when the entry is missing. MF/OS shows only the records, and in a job it prints every record: COUNT and SKIP work at READY only.
Where can I practise PRINT?
Right here, at ZedBank. You take a junior job at a simulated bank and use PRINT in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- IDCAMSThe utility used to create, list, copy and delete datasets, and the standard tool for anything involving VSAM.
- KSDSThe most common VSAM dataset type, where every record has a unique key used to find it directly.
- 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.
- 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.