IDCAMS EXPORT

The IDCAMS EXPORT command creates a backup of a VSAM cluster, alternate index (AIX), or catalog by writing it to a sequential dataset in a special format. That backup can later be restored with the IDCAMS IMPORT command on the same system or on another system. EXPORT is used for backup and recovery, for moving VSAM data between systems or catalogs, and for creating a portable copy that includes both data and catalog-related information. This page explains the EXPORT syntax, when to use EXPORT instead of REPRO, the main parameters (OUTFILE, CIMODE, RECORDMODE, TEMPORARY, PERMANENT, INHIBIT options), and how to allocate the output dataset and run a typical export.

What EXPORT Does

When you run EXPORT, IDCAMS reads the VSAM object (cluster, AIX, or catalog) and writes it to a sequential dataset. The format is not a simple record-by-record copy; it is a backup format that includes structure and catalog information so that IMPORT can recreate the object. That means the backup is self-describing: IMPORT can create the cluster (or AIX) and load the data from the backup without your having to run DEFINE CLUSTER first with the same parameters. So EXPORT is the first step in a backup-and-restore process: EXPORT creates the backup, and IMPORT restores it. You can also use EXPORT to create a copy for transfer to another system—the sequential file can be sent (e.g. via FTP or tape) and then IMPORT can be run on the target.

When to Use EXPORT

Use EXPORT when you need: (1) A backup for recovery—so that if the cluster is lost or damaged you can restore it with IMPORT. (2) A portable copy for another system—export, transfer the sequential file, then import on the other system. (3) A backup that preserves catalog and structure—unlike REPRO, which only copies records and requires the target to be pre-defined. (4) To backup an alternate index or a catalog (when supported). Do not use EXPORT when you only need to copy records from one VSAM file to another existing VSAM file; use REPRO for that. Do not use EXPORT when you need a simple sequential extract for reporting or loading into a different format; REPRO to a sequential file may be simpler.

Syntax and Parameters

The general form of EXPORT is:

jcl
1
2
3
4
5
6
7
8
9
10
EXPORT - entryname - OUTFILE(ddname) - [ CIMODE | RECORDMODE ] - [ TEMPORARY | PERMANENT ] - [ INHIBITSOURCE | NOINHIBITSOURCE ] - [ INHIBITTARGET | NOINHIBITTARGET ] - [ ERASE | NOERASE ] - [ PURGE | NOPURGE ]

entryname is the name of the cluster, AIX, or catalog to export. OUTFILE(ddname) is required and points to the sequential output. The rest are optional. The following table describes the main parameters.

EXPORT parameters
ParameterDescription
entrynameName of the VSAM cluster, alternate index, or catalog to export. This is the object that will be written to the sequential backup.
OUTFILE(ddname)DD name that points to the sequential output dataset. The backup is written to this dataset. It must be allocated with enough space (e.g. LRECL, BLKSIZE, SPACE) to hold the export. RECFM is often VB or U; see your documentation.
CIMODE | RECORDMODECIMODE: export by control interval (faster, bulk). RECORDMODE (default): export by logical record. CIMODE can be more efficient; RECORDMODE is record-oriented. IMPORT must be able to read the format you choose.
TEMPORARY | PERMANENTTEMPORARY: export for temporary use (e.g. transfer); original is kept. PERMANENT: can mean permanent backup or that the export is for a permanent copy. Exact meaning is implementation-dependent.
INHIBITSOURCE | NOINHIBITSOURCEINHIBITSOURCE: restrict access to the source after export (e.g. mark it so it is not used until IMPORT). NOINHIBITSOURCE (default): no restriction. Use when you are migrating or decommissioning the source.
INHIBITTARGET | NOINHIBITTARGETAffects whether the target (backup) dataset can be used before IMPORT. See your IDCAMS documentation for exact behavior.
ERASE | NOERASEWhen used with PERMANENT or delete, ERASE overwrites the source with zeroes. NOERASE leaves the source data on the volume. Affects security and cleanup.
PURGE | NOPURGEWhen deleting or replacing, PURGE overrides retention. NOPURGE (default) respects retention. Relevant if export is combined with delete in your procedure.

OUTFILE and Allocating the Backup Dataset

OUTFILE(ddname) specifies the DD name that points to the sequential dataset where the backup will be written. You must allocate that dataset in your JCL. The dataset typically has variable-length records (RECFM=VB or similar) and a large block size to hold the export format. The space allocation must be large enough for the entire VSAM object (data plus overhead). If the export runs out of space, the job will fail. Allocate with DISP=(NEW,CATLG) or (MOD,CATLG) for a new or existing backup dataset, and use SPACE= to reserve enough tracks or cylinders. Exact RECFM, LRECL, and BLKSIZE can vary by implementation; see your IDCAMS documentation. Example:

jcl
1
2
3
4
5
6
7
8
9
10
//EXPORT EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //BACKUP DD DSN=MY.APPL.EXPORT.BACKUP,DISP=(NEW,CATLG), // SPACE=(CYL,(50,10)),UNIT=SYSDA, // DCB=(RECFM=VB,LRECL=32756,BLKSIZE=32760) //SYSIN DD * EXPORT MY.APPL.PROD.KSDS - OUTFILE(BACKUP) /*

Adjust SPACE and DCB to your site's standards and to the size of the cluster.

CIMODE vs RECORDMODE

CIMODE exports the cluster by control interval (CI). Each CI is written as a unit. That can be faster and can produce a smaller backup in some cases because there is less per-record overhead. RECORDMODE (often the default) exports logical record by logical record. The backup is then record-oriented. When you IMPORT, the backup format must match what IMPORT expects; typically IMPORT can read both, but check your documentation. For a full backup where you care mainly about speed and size, CIMODE is often used. For compatibility or when you need record-level granularity, RECORDMODE may be preferred.

TEMPORARY and PERMANENT

TEMPORARY usually means the export is for a temporary purpose (e.g. transfer or one-time copy) and the original cluster is to remain in place and usable. PERMANENT can mean the export is for a permanent backup, or in some implementations it can be used when the source is to be deleted or moved after export. The exact behavior of TEMPORARY and PERMANENT can vary by IDCAMS version and object type. See your documentation. In many cases you use the default (often PERMANENT for backup) and the source cluster is unchanged after EXPORT unless you run a separate DELETE or migration step.

EXPORT vs REPRO

REPRO copies records from a source to a target. The target can be VSAM or sequential. The output is normal data—either a VSAM cluster (which must already exist) or a sequential file with records. EXPORT writes a special backup format that IMPORT can use to recreate the full VSAM object. So: use EXPORT when you need a backup for restore (IMPORT) or for cross-system transfer. Use REPRO when you need to copy data to an existing dataset or create a simple sequential extract. The following table summarizes.

EXPORT vs REPRO
AspectEXPORTREPRO
Output formatSpecial backup format for IMPORTNormal VSAM or sequential data
RestoreUse IMPORT to recreate full objectTarget must be pre-defined; REPRO only copies records
Use caseBackup, recovery, cross-system transferCopy, extract, merge datasets

Exporting Alternate Indexes and Catalogs

You can export an alternate index by name; the AIX cluster and its components are written to the backup. When restoring, you typically IMPORT the base cluster first, then the AIX (and define paths if needed). Exporting a catalog is a specialized operation; follow your installation's procedures and documentation. Catalog export/import can have additional options and ordering requirements.

Key Takeaways

  • EXPORT creates a sequential backup of a VSAM cluster, AIX, or catalog in a format that IMPORT can use to restore the object.
  • Specify the object by name (entryname) and the output with OUTFILE(ddname). Allocate the output dataset with enough space and the correct DCB.
  • CIMODE exports by control interval (faster); RECORDMODE exports by logical record. Choose based on speed and compatibility with IMPORT.
  • Use EXPORT for backup and recovery and for cross-system transfer; use REPRO for copying between existing datasets.

Explain Like I'm Five

EXPORT is like putting your toys in a special box so you can move the box or save it. The box has a special shape (the backup format) so that when you open it later (IMPORT), you can put the toys back exactly as they were. REPRO is like copying your toys one by one into another drawer—the drawer (target) has to already exist. So EXPORT is for "pack everything up to unpack later"; REPRO is for "copy from here to there."

Test Your Knowledge

Test Your Knowledge

1. What do you use to restore an EXPORT backup?

  • REPRO
  • IMPORT
  • DEFINE CLUSTER
  • LISTCAT

2. What does OUTFILE specify in EXPORT?

  • The VSAM cluster to export
  • The DD name for the sequential backup output
  • The catalog name
  • The volume

3. When would you use EXPORT instead of REPRO?

  • To copy records to another VSAM file
  • To create a backup that can be restored with IMPORT on another system
  • To list catalog entries
  • To delete a cluster
Published
Updated
Read time6 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: IBM z/OS DFSMS documentationSources: IBM DFSMS Access Method Services CommandsApplies to: z/OS 2.5