Backups VSAM file (EXPORT)


The EXPORT command creates a backup of VSAM datasets by copying them to a sequential data set. This backup is used for archival purposes or transferred to another system. The EXPORT operation is normally paired with the IMPORT, which restores the backup into a VSAM dataset.

Syntax -

//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  EXPORT entryname
  	{OUTFILE(ddname)}
  	[CIMODE | RECORDMODE]
  	[ERASE | NOERASE]
  	[INHIBITSOURCE | NOINHIBITSOURCE]
  	[INHIBITTARGET | NOINHIBITTARGET]
  	[PURGE | NOPURGE]
  	[TEMPORARY | PERMANENT]
/*

Mandatory Parameters


  • entryname - SSpecifies the name of the dataset or catalog entry to be exported. This can be a VSAM dataset or a catalog.
  • OUTFILE(ddname) - Specifies the DD name of the sequential dataset where the exported data will be written. This dataset should be pre-allocated before running the EXPORT command. The default block size for EXPORT is 2048. Short Description: OFILE

Optional Parameters


  • CIMODE | RECORDMODE -
    • CIMODE - Specifies the data records written to the output dataset as one VSAM control interval. i.e., it uses control interval processing. Each control interval is processed as one logical record. So this mode makes the processing more quickly. Short Description: CIM
    • RECORDMODE - Specifies the data records written to the output dataset as one VSAM logical record. It is the default for ESDS, KSDS, and RRDS clusters. Short Description: RECM
  • ERASE | NOERASE - Default: NOERASE
    • ERASE - specifies the cluster components memory is to be erased with binary zeroes when cluster is deleted. Short Description: ERAS
    • NOERASE - specifies the cluster components memory is not to be erased when cluster is deleted. Short Description: NERAS
  • INHIBITSOURCE | NOINHIBITSOURCE -
    • INHIBITSOURCE - Specifies the input dataset records cannot be accessed for any operation other than retrieval after EXPORT. Use INHABITSOURCE when the object is exporting temporarily. Short Description: INHS
    • NOINHIBITSOURCE - Specifies no restriction in accessing the input dataset records after EXPORT. Short Description: NINHS
  • INHIBITTARGET | NOINHIBITTARGET -
    • INHIBITTARGET - Specifies the output dataset records cannot be accessed for any operation other than retrieval after EXPORT. Short Description: INHT
    • NOINHIBITTARGET - Specifies that there will be no restriction in accessing the output dataset records after EXPORT. Short Description: NINHT
  • PURGE | NOPURGE -
    • PURGE - Specifies the output objects should delete if the retention period has not expired. Short Description: PRG
    • NOPURGE - Specifies the output objects should not delete until the retention period has expired. Short Description: NPRG
  • TEMPORARY | PERMANENT -
    • TEMPORARY - Specifies that the cluster, alternate index, or catalog is not to be deleted from the original system. Short Description: TEMP
    • PERMANENT - Specifies that the cluster or alternate index will be deleted from the original system. PERMANENT is default. Short Description: PERM

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----+
...
//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