The IDCAMS IMPORT command restores a VSAM cluster, alternate index (AIX), or catalog from a backup that was created with the IDCAMS EXPORT command. The backup is stored as a sequential dataset; IMPORT reads that dataset and recreates the VSAM object, including catalog information and data. You can restore to the same name or to a new name (NEWNAME or OUTDATASET), and you can specify volumes for the restored object. IMPORT is the counterpart to EXPORT: use EXPORT to create a portable backup, and IMPORT to restore it on the same system or on another system. This page explains the IMPORT syntax, when to use IMPORT instead of REPRO, the main parameters (INFILE, INDATASET, OUTDATASET, NEWNAME, INTOEMPTY, VOLUMES), and how to restore after a failure or for testing.
When you run EXPORT, IDCAMS writes the VSAM object (cluster, AIX, or catalog) to a sequential dataset in a format that includes both the data and catalog-related information. That format is not plain record copy; it is a backup format that preserves structure and attributes. IMPORT reads that sequential dataset and recreates the VSAM object. The target can be a new name (you are restoring to a different cluster name) or the same name (you are restoring over a lost or damaged cluster). In many implementations, IMPORT can create the target cluster as part of the restore, so you do not have to DEFINE CLUSTER first. That differs from REPRO, which copies records from a source to an already-defined target. So IMPORT is for "restore from EXPORT backup"; REPRO is for "copy from one dataset to another."
Use IMPORT when you have a backup that was created with EXPORT and you need to restore the VSAM object. Typical situations: (1) Recovery after a failure—the cluster was damaged or lost and you have an EXPORT backup. (2) Restoring to a test or parallel name—you export production and import to a different cluster name for testing. (3) Moving data between systems or catalogs—EXPORT creates a portable backup; you transfer the sequential file and run IMPORT on the target system. (4) Restoring an alternate index or a catalog from backup. Do not use IMPORT to copy from a live VSAM file to another; use REPRO for that. Do not use IMPORT to read a dataset that was not created by EXPORT; the format is specific to EXPORT/IMPORT.
The general form of IMPORT is:
123456789IMPORT - { INFILE(ddname) | INDATASET(dataset-name) } - OUTDATASET(output-dataset-name) - [ NEWNAME(newname) ] - [ INTOEMPTY ] - [ VOLUMES(volser [ volser ... ]) ] - [ PURGE | NOPURGE ] - [ ERASE | NOERASE ]
You must specify the input (INFILE or INDATASET) and the output (OUTDATASET). The rest are optional. The following table describes each parameter.
| Parameter | Description |
|---|---|
| INFILE(ddname) | DD name that points to the sequential backup dataset produced by EXPORT. Use when the backup is allocated via a DD in your JCL. |
| INDATASET(dataset-name) | Catalog name of the sequential backup dataset. Use when the backup is cataloged and you refer to it by name. |
| OUTDATASET(dataset-name) | Name of the target VSAM object to create or receive the imported data. Can be a new name (cluster is created) or an existing empty cluster when INTOEMPTY is used. |
| NEWNAME(newname) | Optional. Restore the object under a different name. The backup was created from one name; OUTDATASET or NEWNAME specifies the name for the restored object. |
| INTOEMPTY | Indicates the target is empty or is to be created for the import. Required in some environments when the target does not exist or has no data. Ensures IMPORT does not append to an existing non-empty cluster by mistake. |
| VOLUMES(volser [...]) | Optional. Volume serial(s) where the restored cluster is to be allocated. Omit to let the system or SMS choose. Use when you need to place the cluster on specific volumes. |
| PURGE | NOPURGE | PURGE: replace or delete existing object even if retention has not expired. NOPURGE (default): do not replace if retention applies. Use PURGE when restoring over an existing object that has retention. |
| ERASE | NOERASE | Affects whether data is overwritten when the target is deleted or replaced. NOERASE is often the default. See your IDCAMS documentation for exact behavior. |
INFILE(ddname) means the backup dataset is allocated via a DD statement in your JCL; you give the DD name. Use INFILE when the backup is in a cataloged dataset that you reference with a DD (e.g. //BACKUP DD DSN=MY.EXPORT.BACKUP,DISP=SHR). INDATASET(dataset-name) means you give the catalog name of the backup dataset directly. Use INDATASET when the backup is in the default catalog or when the name will resolve. If the backup is in a user catalog, ensure JOBCAT or STEPCAT points to that catalog so the name resolves, or use INFILE with a DD that points to the backup.
OUTDATASET is the name of the target VSAM object that will receive the restored data. It can be the same as the original name (restore in place) or a new name (restore to a different cluster). NEWNAME(newname) is an alternative or additional way to specify a new name for the restored object; behavior can vary by implementation. In either case, the restored cluster (or AIX) will be known by the name you specify. If you are restoring over an existing cluster, that cluster may need to be deleted first or IMPORT may replace it depending on options and implementation. Check your IDCAMS documentation. When restoring for testing, use OUTDATASET with a test name (e.g. MY.APPL.TEST.KSDS) so you do not overwrite production.
INTOEMPTY indicates that the target is empty or is to be treated as empty for the import. Some implementations require INTOEMPTY when the target cluster does not exist (IMPORT will create it from the backup) or when the target exists but has no records. Using INTOEMPTY avoids accidentally appending imported data to an existing cluster that already has data. If you omit INTOEMPTY and the target has data, the behavior may be implementation-dependent (error or append). For a clean restore, specify INTOEMPTY when the target is empty or new.
REPRO copies records from a source dataset to a target dataset. Both source and target are typically already defined. REPRO does not create the target; you must DEFINE CLUSTER (or have a sequential output) first. EXPORT writes a special sequential backup that contains data plus catalog/structure information. IMPORT reads that backup and can recreate the VSAM object. So: use EXPORT to create a backup, and IMPORT to restore it. Use REPRO to copy data between two existing datasets (VSAM to VSAM, sequential to VSAM, or VSAM to sequential). The following table summarizes the difference.
| Aspect | IMPORT | REPRO |
|---|---|---|
| Input | Sequential backup from EXPORT | Live VSAM or sequential dataset |
| Target | Can create or replace; backup has catalog info | Target must exist and be pre-defined |
| Use case | Restore from backup, move between systems | Copy data between existing datasets |
Suppose you have an EXPORT backup in MY.APPL.EXPORT.BACKUP and you want to restore it to MY.APPL.RESTORED.KSDS. The target does not exist yet.
123456789//RESTORE EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //BACKUP DD DSN=MY.APPL.EXPORT.BACKUP,DISP=SHR //SYSIN DD * IMPORT INFILE(BACKUP) - OUTDATASET(MY.APPL.RESTORED.KSDS) - INTOEMPTY /*
If the backup were cataloged and you used INDATASET:
1234IMPORT INDATASET(MY.APPL.EXPORT.BACKUP) - OUTDATASET(MY.APPL.RESTORED.KSDS) - INTOEMPTY
Restore the same backup to a different name and place it on a specific volume:
12345IMPORT INFILE(BACKUP) - OUTDATASET(MY.APPL.TEST.KSDS) - INTOEMPTY - VOLUMES(TEST01)
You can EXPORT and IMPORT alternate indexes and catalogs as well as clusters. For an AIX, the backup contains the AIX cluster and its data and index components. IMPORT restores the AIX; if the base cluster was also restored, ensure the AIX is restored after the base so the relationship is correct. For catalog export/import, follow your installation's procedures; catalog restore is a critical operation and may require specific options and order. See your IDCAMS and catalog documentation.
EXPORT is like putting your toys in a special box so you can move them or save them. IMPORT is like opening that box and putting the toys back—either in the same place or in a new place (new name). The box has to be the one EXPORT made; you can't use a different kind of box (another file format). INTOEMPTY means "the shelf where I'm putting them is empty," so you don't mix the restored toys with other ones already there.
1. What creates the backup that IMPORT reads?
2. When do you use INTOEMPTY?
3. Can you restore an exported cluster under a different name?