IDCAMS Backups VSAM file (EXPORT) Example


Scenario - Export KSDS to PS file.

Input ESDS File - MATEPK.TEST.ESDS

<===>----10---+----2----+----3----+----4----+--       
****  Top of data  ****                               
E0001EMPLOYEE1     DIR       LOC1 0000100000          
E0002EMPLOYEE2     MGR  DEPT1LOC1 0000080000          
E0003EMPLOYEE3     MGR  DEPT2LOC2 0000075000          
E0004EMPLOYEE4     TL   DEPT1LOC1 0000050000          
E0005EMPLOYEE5     SSE  DEPT1LOC1 0000045000          
E0006EMPLOYEE6     SE   DEPT1LOC1 0000034000          
E0007EMPLOYEE7     SSE  DEPT2LOC2 0000046000          
****  End of data  ****

JCL -

----+----1----+----2----+----3----+----4----+----5----+
//MATEPKE JOB (123),'MTH',CLASS=A,MSGCLASS=A,
//             MSGLEVEL=(1,1),NOTIFY=&SYSUID
//********************************************************
//* EXPORT DATA FROM VSAM KSDS TO PS DATA SET
//********************************************************
//STEP010  EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INPUT    DD DSN=MATEPK.EMPL.KSDS,DISP=SHR
//OUTPUT   DD DSN=MATEPK.EMPL.BACKUP,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(3,2),RLSE),
//            UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=47,BLKSIZE=470)
//SYSIN    DD  *
  EXPORT                 -
       MATEPK.EMPL.KSDS  -
       OUTFILE(OUTPUT)   -
       CIMODE            -
       NOINHIBITSOURCE
/*

Output -

Once the above JCL is submitted, it backups the data from the data deletes the input VSAM file.

EXPORT Sysprint

Explaining Example -

In the above example,

  • MATEPK.EMPL.KSDS specifies the input file.
  • OUTFILE(OUTPUT) specifies the output file.
  • CIMODE specifies control interval should treat as one logical record.
  • NOINHIBITSOURCE specifies the input file records can available for reading, writing, etc.