Module 3: Access Method Services (AMS)
IDCAMS IMPORT Command
- IMPORT command is used to restore the exported object created from EXPORT command
- A sequential dataset created by the EXPORT command may only be processed as input to the IMPORT command, which will result in an equivalent copy of the original source cluster.
- EXPORT/IMPORT can only be used with VSAM datasets(KSDS, ESDS, RRDS and LDS) and Alternate indexes
- Since exported object cannot be used without performing subsequent IMPORT, this process of EXPORT/IMPORT takes more time as compared to REPRO.
Syntax format 1:IMPORT INFILE(ip-ddName) - OUTFILE(op-ddName) - [optional-paramter]
Syntax format 2:IMPORT INDATASET(ip-datasetName) - OUTDATASET(op-datasetName) - [optional-paramter]
- ip-ddName and 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)
- ip-datasetName and op-datasetName points to the physical name of the input dataset(portable dataset created out of EXPORT operation) and output dataset(dataset on which data is to be imported). Ex. DEPT.VSAM.KSDSFILE
- Optional parameters:-
Parameter Description INTOEMPTY
OBJECTS ((entryname [FILE(ddname)] [MANAGEMENTCLASS(class)] [NEWNAME(newname)] [STORAGECLASS(class)] [VOLUMES(volser[ volser...])]) [(entryname...)...])
- Specifies that you are importing from the portable data set into an empty data set. If this parameter is not specified an attempt to import into an empty data set is unsuccessful.
- Allows us to change some of the attributes of new target dataset including MANAGEMENTCLASS, STORAGECLASS, and VOLUMES. It also allows to give new name.
Use of IMPORT command to RESTORE portable backup copy to KSDS file
//RESOTRES EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //BACKUP DD DSN=PAYT.PAYROLL.EXPORT.BKUP,DISP=SHR //SYSIN DD * IMPORT - INFILE(BACKUP) - OUTDATASET(PAYT.PAYROLL.KSDS.FILE) /*
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