PRINT Command (for Experienced)


The PRINT command is used to print the dataset (VSAM datasets, non-VSAM datasets, and catalogs) contents. The output can be available in various formats like CHAR, HEX, and DUMP.

High-level syntax -


//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  PRINT {INFILE(ddname)|
  	    INDATASET(dataset-name)}
/*

Detail syntax -


//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  PRINT {INFILE(ddname)|
  	    INDATASET(dataset-name)}
  	    [CHARACTER|DUMP|HEX]
  	    [FROMKEY(key)|FROMADDRESS(address)|
  	     FROMNUMBER(number)|SKIP(number)]
  	    [OUTFILE(ddname)]
  	    [TOKEY(key)|TOADDRESS(address)|
  	     TONUMBER(number)|COUNT(number)]
/*

Parameters


The PRINT command uses to print the dataset, the mandatory and optional parameters are specified below.

Mandatory Parameters


INFILE (ddname)


  • Prints the dataset or component identified by ddname. Short Description: IFILE

INDATASET (dataset-name)


  • Prints the dataset or component identified by dataset-name. Short Description: IDS

Optional Parameters


CHARACTER | DUMP | HEX


  • These options specify the output format in which format (CHAR/HEX/DUMP) it prints. Short Description: CHAR (CHARACTER)

FROMKEY(key) | FROMADDRESS(address) | FROMNUMBER(number) | SKIP(number)


  • Specifies the starting position where the listing should start.
  • If any of these parameters are not specified, the listing begins with the first logical record in the dataset.

Short Descriptions: FKEY (FROMKEY), FADDR (FROMADDRESS), FNUM (FROMNUMBER)

OUTFILE(ddname)


  • Identifies a target dataset other than SYSPRINT. Short Description: OFILE

TOKEY(key) | TOADDRESS(address) | TONUMBER(number) | COUNT(number)


  • Specifies the starting position where the listing should end.
  • If any of these parameters are not specified, the listing ends at the logical record in the dataset.

Short Descriptions: TADDR (TOADDRESS), TNUM (TONUMBER)

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 -


Requirement - Print AIX for the records information.

Input AIX - MATEPK.EMPL.DEPTAIX

AIX input

Code -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKP JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),            
//             NOTIFY=&SYSUID                                           
//************************************************************          
//* PRINT/DISPLAY VSAM DATA                                             
//************************************************************          
//STEP10   EXEC PGM=IDCAMS                                              
//SYSPRINT DD SYSOUT=*                                                  
//SYSIN    DD *                                                         
  PRINT                               -                                 
       INDATASET(MATEPK.EMPL.DEPTAIX) -                                 
       CHAR                                                             
/*                                                                      
//*                                                                     
**************************** Bottom of Data ****************************

In the above JCL, MATEPK is the userid and change it as required.

Output -

Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, then printing is successful..

********************************* TOP OF DATA **********************************
IDCAMS  SYSTEM SERVICES                                           TIME: 09:49:29
                                                                                
  PRINT                            -                                            
       INDATASET(MATEPK.EMPL.DEPTAIX) -                                         
       CHAR                                                                     
IDCAMS  SYSTEM SERVICES                                           TIME: 09:49:29
LISTING OF DATA SET -MATEPK.EMPL.DEPTAIX                                        
KEY OF RECORD -                                                                 
.....     E0001                                                                 
KEY OF RECORD - DEPT1                                                           
.....DEPT1E0002E0004E0005E0006                                                  
KEY OF RECORD - DEPT2                                                           
.....DEPT2E0003E0007                                                            
IDC0005I NUMBER OF RECORDS PROCESSED WAS 3                                      
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0                       
IDCAMS  SYSTEM SERVICES                                           TIME: 09:49:29
                                                                                
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0               
******************************** BOTTOM OF DATA ********************************

Explaining Example -

In the above example,

  • INDATASET(MATEPK.EMPL.DEPTAIX) Specifies the ALTERNATE INDEX component name.
  • CHAR Prints the data in character format.