Displays file contents (PRINT)
Displays file contents (PRINT)
The PRINT command is used to display or print the contents of a dataset, particularly VSAM datasets, for analysis and reporting. This command can print records from VSAM clusters, ESDS, KSDS, RRDS, and even non-VSAM sequential datasets. It is a useful tool for inspecting the data content and ensuring data integrity. The output can be available in various formats like CHAR, HEX, and DUMP.
Syntax -
//JOBNAME JOB job-card-parameters
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
PRINT {INFILE(ddname) |
INDATASET (dataset-name)}
[OUTFILE(ddname) |
OUTDATSET (dataset-name)]
[CHARACTER | DUMP | HEX]
[FROMKEY(key) |
FROMADDRESS(address)|
FROMNUMBER(number) |
SKIP(number)]
[TOKEY(key) |
TOADDRESS(address) |
TONUMBER(number) |
COUNT(number)]
/*
Mandatory Parameters
- INFILE (ddname) - Specifies the DD name of the dataset to be printed. Short Description: IFILE
- INDATASET (dataset-name) - Specifies the dataset name that is to be printed. Short Description: IDS
Optional Parameters
- OUTFILE(ddname) - Specifies the DD name of the output dataset where the printed content will be directed. If omitted, the output is sent to the system output (SYSPRINT). Short Description: OFILE
- OUTDATASET (dataset-name) - Specifies output dataset where the printed content will be directed. Short Description: ODS
- CHARACTER | DUMP | HEX - These options specify in which format (CHAR/HEX/DUMP) it prints. Short Description: CHAR (CHARACTER)
- FROMKEY(key) | FROMADDRESS(address) | FROMNUMBER(number) | SKIP(number) - Specifies the starting position from where the listing should start. If any of these parameters are not coded, the listing begins with the first logical record in the dataset. Short Descriptions: FKEY (key), FADDR (address), FNUM (number)
- TOKEY(key) | TOADDRESS(address) | TONUMBER(number) | COUNT(number) - Specifies the ending position where the listing should end. If any of these parameters are not coded, the listing ends at the last logical record in the dataset. Short Descriptions: TADDR (address), TNUM (number)
Where to start printing | Where to stop printing | Where used |
---|---|---|
SKIP(number) | COUNT(number) | KSDS, ESDS, RRDS, NON-VSAM |
FROMKEY(key-values) | TOKEY(key-value) | KSDS, ALTERNATE INDEX |
FROMADDRESS(RBA) | TOADDRESS(RBA) | KSDS, ESDS |
FROMNUMBER(RRN) | TONUMBER(RRN) | RRDS |
Example1 -
Scenario - Check the VSAM file is empty.
Input AIX - MATEPK.EMPL.DEPTAIX
JCL -
----+----1----+----2----+----3----+----4----+----5----+
...
//STEP10 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
PRINT -
INDATASET(MATEPK.EMPL.DEPTAIX) -
CHAR
/*
...
Output -
Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, then the file has the records. If the MAXCC is 12, then the file is empty.
Explaining Example -
In the above example,
- INDATASET(MATEPK.EMPL.DEPTAIX) Specifies the ALTERNATE INDEX component name.
- CHAR Prints the data in character format.