IDCAMS Displays file contents (PRINT) Example


Scenario - Check the VSAM file is empty.

Input AIX - MATEPK.EMPL.DEPTAIX

AIX input

JCL -

----+----1----+----2----+----3----+----4----+----5----+
//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
/*

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.

PRINT Sysprint

Explaining Example -

In the above example,

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