PRINT Command (for Beginners)


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.

Detailed 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 mandatory and optional parameters are specified below -

Mandatory Parameters


Parameters Description
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


Parameters Description
CHARACTER | DUMP | HEX These options specify the output format in which format (CHAR/HEX/DUMP) it prints.
Short Description: CHAR (CHARACTER)
OUTFILE(ddname) Identifies a target dataset other than SYSPRINT.
Short Description: OFILE
FROMKEY(key) | FROMADDRESS(address) | FROMNUMBER(number) | SKIP(number) Specifies the starting position where the listing should start.
Short Description: FKEY (FROMKEY), FADDR (FROMADDRESS), FNUM (FROMNUMBER)
TOKEY(key) | TOADDRESS(address) | TONUMBER(number) | COUNT(number) Specifies the starting position where the listing should end.
Short Description: TADDR (TOADDRESS), TNUM (TONUMBER)

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.