IMPORT Command (for Beginners)


The IMPORT command imports or restores a cluster, AIX, or catalog from a backup to the original.

The input is the backup created by EXPORT, and the output is the base file from where the data was exported earlier.

Detailed syntax -


//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  IMPORT 	{INFILE(ddname)|INDATASET(dataset-name)}
  	{OUTFILE(ddname)| OUTDATASET(dataset-name)}
  	[ALIAS|NOALIAS]
  	[ERASE|NOERASE]
  	[INTOEMPTY]
  	[LOCK|UNLOCK]
  	[OBJECTS
  	  ((entryname
  	   [FILE(ddname)]
  	   [MANAGEMENTCLASS(class)]
  	   [NEWNAME(newname)]
  	   [STORAGECLASS(class)]
  	   [VOLUMES(volser[ volser...])])
  	 [(entryname...)...])]
  	[PURGE|NOPURGE]
  	[CATALOG(catname)]
/*

Parameters


The IMPORT command mandatory and optional parameters are specified below -

Mandatory Parameters


Parameters Description
INFILE(ddname) Specifies the input ddname that identifies the copy of the cluster or alternate index or user catalog.
Short Description: IFILE
OUTFILE(ddname) Specifies the output DDname that identifies the dataset, alternate index, or user catalog.
Short Description: OFILE
INDATASET(dataset-name) Specifies the input DSN name that contains a copy of the cluster, alternate index, or user catalog.
Short Description: IDS
OUTDATASET(dataset-name) Specifies the output DSN name of the cluster, alternate index, or user catalog.
Short Description: ODS

Optional Parameters


Parameters Description
ERASE | NOERASE ERASE option makes the component overwrites with binary zeros or not when the cluster or alternate index is deleted.
Short Description: ERAS | NERAS
INTOEMPTY Specifies that the output dataset is an empty data set.
Short Description: IEMPTY
LOCK | UNLOCK Specifies the imported catalog is to be locked or unlocked.
PURGE | NOPURGE Specifies the objects delete or not if the retention period has not expired.
Short Description: PRG | NPRG

Example -


Requirement - Import backup PS file to KSDS.

Input ESDS File - MATEPK.EMPL.BACKUP

Code -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKI JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),            
//             NOTIFY=&SYSUID                                           
//************************************************************          
//* IMPORT BACKUP PS DATA TO THE KSDS DATA SET                          
//************************************************************          
//STEP010  EXEC PGM=IDCAMS                                              
//SYSPRINT DD SYSOUT=*                                                  
//BACKUP   DD DSN=MATEPK.EMPL.BACKUP,DISP=SHR                           
//SYSIN    DD  *                                                        
  IMPORT                             -                                  
       INFILE(BACKUP)                -                                  
       OUTDATASET(MATEPK.EMPL.KSDS)  -                                  
       INTOEMPTY                                                        
/*                                                                      
//*                                                                     
**************************** Bottom of Data ****************************

In the above JCL, MATEPK is the userid and change it as required.

Output -

Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, then REPRO is successful..

********************************* TOP OF DATA **********************************
IDCAMS  SYSTEM SERVICES                                           TIME: 07:28:10
                                                                                
  IMPORT                             -                                          
       INFILE(BACKUP)                -                                          
       OUTDATASET(MATEPK.EMPL.KSDS)  -                                          
       INTOEMPTY                                                                
IDC0604I DATA SET BEING IMPORTED WAS EXPORTED ON   04/29/22 AT 07:25:33         
IDC0508I DATA ALLOCATION STATUS FOR VOLUME DEVHD4 IS 0                          
IDC0509I INDEX ALLOCATION STATUS FOR VOLUME DEVHD4 IS 0                         
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0                       
                                                                                
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0               
******************************** BOTTOM OF DATA ********************************

Explaining Example -

In the above example,

  • INFILE(BACKUP) specifies the source backup PS file.
  • OUTDATASET(MATEPK.EMPL.KSDS) specifies the original file that needs to create to import the data.
  • INTOEMPTY specifies the target file is empty.