Module 3: Access Method Services (AMS)
IDCAMS EXPORT Command
- EXPORT is used for creating portable backup copy and IMPORT command is used for restoration
- EXPORT command is most popular method for creating backup copy as this copy can also be exported to a different (but compatible) system.
- EXPORT/IMPORT can only be used with VSAM datasets(KSDS, ESDS, RRDS and LDS) and Alternate indexes
- EXPORT copies the information required to completely reconstruct the cluster without the necessity of executing a separate DEFINE. The portable copy of the exported cluster must always be contained in a non-VSAM, sequential dataset.
Syntax format 1:EXPORT entry-name - OUTFILE(op-ddName) - [optional-paramter]
Syntax format 2:EXPORT entry-name - OUTDATASET(op-datasetName) - [optional-paramter]
- entry-name specifies the name of cluster, alternate index or user catalog to be exported
- op-ddName points to the logical name of the input and output dataset respectively as mentioned in the DD statement of same step. Example: //VSAMFL DD DEPT.VSAM.KSDSFILE,DISP=SHR In above statement VSAMFL indicates DDNAME (i.e. logical name of Dataset)
- op-datasetName points to the physical name of the input and output dataset respectively. Ex. DEPT.VSAM.KSDSFILE
- Optional parameters:-
Parameter Description ERASE | NOERASE
- Specify whether the components of a cluster or alternate index to be exported are to be erased(i.e. overwritten with binary zeroes)
- When specified ERASE, the data component is overwritten with binary zeroes when the cluster or alternate index is deleted
- When specified NOERASE, the data component is not overwritten with binary zeroes when the cluster or alternate index is deleted
INHIBITSOURCE | NOINHIBITSOURCE
- Specify how the data records in the source data set (ALTERNATE INDEX and CLUSTER) can be accessed after they have been imported to another system. Use the ALTER command to change this parameter.
- When specified INHIBITSOURCE, the original data records in the original system cannot be accessed for any operation other than retrieval.
- When specified NOINHIBITSOURCE, the original data records in the original system can be accessed for any kind of operation.
INHIBITTARGET | NOINHIBITTARGET
- Specify whether or not the data records copied into the target cluster or alternate index can be accessed for any operation other than retrieval after they have been imported to another system. This specification can be changed through the ALTER command.
- When specified INHIBITTARGET, the target object cannot be accessed for any operation other than retrieval after it has been imported into another system.
- When specified NOINHIBITTARGET, the target object can be accessed for any type of operation after it has been imported into another system.
PURGE | NOPURGE
- Specify whether or not the cluster or alternate index to be exported is to be deleted from the original system regardless of the retention period specified in a TO or FOR parameter when the object was defined
- This parameter can be specified only if the object is to be permanently exported, that is, deleted from the original system. Therefore, it does not apply to catalogs that must be exported as TEMPORARY.
- When specified PURGE, the object is deleted even if the retention period has not expired.
- When specified NOPURGE, the object is not deleted unless the retention period has not expired.
TEMPORARY | PERMANENT
- Specify whether or not the cluster, alternate index, or catalog to be exported is to be deleted from the original system
- When specified TEMPORARY, the cluster or alternate index is not deleted from the original system. The object in the original system is marked as TEMPORARY to indicate that another copy exists and that the original copy can be replaced.
- When specified PERMANENT, the cluster or alternate index is deleted from the original system. Its storage space is freed. If its retention period has not yet expired, you must also code PURGE.
Use of EXPORT command to create portable backup copy of KSDS file
//BACKUPKS EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //BACKUP DD DSN=PAYT.PAYROLL.EXPORT.BKUP, // DISP=(NEW,CATLG,KEEP), // UNIT=TEST,SPACE=(CYL,(10,10),RLSE), // DCB=(BLKSIZE=0) //SYSIN DD * EXPORT - PAYT.PAYROLL.PRCSKSDS.MSTR - OUTFILE(BACKUP) - TEMPORARY - INHIBITSOURCE - INHIBITTARGET /*
Benefits of EXPORT/IMPORT over REPRO:-
- Along with data records, this method also exports catalog information
- While restoring exported object using IMPORT command, Target cluster deletion and redefinition is not required because the exported object already contains catalog information
- Since exported object contains catalog information it can be easily ported to the other (but compatible) system. An exported object has cross-system portability