IMPORT Command (for Experienced)
Summary
For basic information, go through the 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.
High-level syntax -
//JOBNAME JOB job-card-parameters
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
IMPORT Command
/*
Detail 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
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.
- If the corresponding object has its DATA and INDEX components on different device types, specify OUTDATASET instead of OUTFILE.
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
ALIAS | NOALIAS
- ALIAS forces the IMPORT command to retrieve the exported aliases and define them for the catalog imported.
- NOALIAS results that no aliases are being imported.
- NOALIAS is the default if not specified.
Short Description: ALS or NALS
CATALOG (cat-name)
- Specifies the catalog name in which the imported object is to be catalogued.
- This parameter is ignored if the object is a catalog dataset.
Short Description: CAT
ERASE
- ERASE option makes the component overwrites with binary zeros when the cluster or alternate index is deleted.
Short Description: ERAS
NOERASE
- Specifies that the component leaves as it is without overwriting when the cluster or alternate index is deleted.
Short Description: NERAS
INTOEMPTY
- Specifies that the output dataset is an empty data set. If the INTOEMPTY parameter is not specified, an attempt to import into an empty dataset is unsuccessful.
Short Description: IEMPTY
LOCK
- Specifies the imported catalog is to be locked. Nonexisting or existing unlocked catalogs are defined as locked.
UNLOCK
- Specifies that the imported catalog is to be unlocked. Nonexisting or existing locked catalogs are defined as unlocked. If not specified, the catalog is unlocked.
OBJECTS
((entryname
[FILE(ddname)]
[MANAGEMENTCLASS(class)]
[NEWNAME(newname)]
[STORAGECLASS(class)]
[VOLUMES(volser[ volser...])])
[(entryname...)...])
- Specifies the new or changing attributes for the cluster, AIX, any associated paths, or user catalog to be imported.
- An error message is issued when importing a catalogue, and processing ends if specified NEWNAME.
PURGE
- Specifies the objects should delete if the retention period has not expired.
Short Description: PRG
NOPURGE
- Specifies the objects should not delete until the retention period has expired.
Short Description: 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.