EXPORT and IMPORT CLUSTER command.


EXPORTING VSAM CLUSTERs:

The EXPORT command is used to create a portable copy of a VSAM cluster. 
When REPRO is used to copy, only data records are copied .
To restore the cluster must be first created by executing an AMS DEFINE command.  EXPORT copies the information required to completely reconstruct the cluster without the necessity of executing a separate DEFINE.

Syntax:

EXPORT entryname[/password]
    {OUTFILE(ddname)  |  OUTDATASET(entryname)}
    [ERASE  |  NOERASE]
    [INFILE(ddname)]
    [INHIBITSOURCE  |  NOINHIBITSOURCE]
    [INHIBITTARGET  |  NOINHIBITTARGET]
    [PURGE  |  NOPURGE]
    [TEMPORARY  |  PERMANENT]

·        PERMANENT: When this option is selected , once the export operation is successful AMS will try to delete the original cluster.
·        IF TEMPORARY is selected then It will not try to delete the original Object.

·        ERASE: If the PERMANENET option is put AMS wil try to delete the original file. By default  If the ERASE attribute was specified for the cluster, the cluster will be overwritten with binary zeros before it is deleted.  The ERASE / NOERASE option may be specified on the EXPORT command to override the attribute specified when the cluster was defined.

·        PURGE/NO PURGE
If a retention period was specified for the cluster and has not been reached, the delete will not take place.  The PURGE / NOPURGE option may be specified on the EXPORT command to override the retention status of the source cluster.

·        INHIBITSOURCE may be specified to mark the source cluster as "read only" after the successful completion of the EXPORT. 

·        INHIBITTARGET may be specified to mark any copy of the cluster created from the portable copy as "read only".  

Example 1 Exporting a Cluster:
===>                                                  Scr
***************************** Top of Data ****************
//JOB00009 JOB (XXXX),'ACCESS METHOD',NOTIFY=SYSUID      
//STEP0001 EXEC PGM=IDCAMS                               
//SYSPRINT DD   SYSOUT=*                                 
//INDATA1  DD *                                          
 1SUKUL IS GREAT                                         
 2SUKUL IS VERY GREAT                                    
 3SUKUL IS THE GREAT                                      
/*                                                       
//SYSIN    DD *                                          
 DELETE SM017R.TEST.VSAM1 CLUSTER PURGE                  
 /* ABOVE DELETES IF THE KSDS EXISTS */                   
 DEFINE CLUSTER(                    -                    
       NAME (SM017R.TEST.VSAM1)      -                   
       TRK  (1 1)                    -                   
       INDEXED                       -                   
       KEYS (1 1)                    -                   
       RECORDSIZE (80 80))                               
 IF LASTCC=0 THEN                    -                   
     EXPORT SM017R.TEST.VSAM1         -                  
     OUTDATASET(SM017R.TEST.VSAMX)   -                   
     PERMANENT                                           
/*

IMPORTING VSAM CLUSTER:

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. 

Step 1: AMS first searches the target catalog for an entry with the same name as the cluster being imported.  If an entry does not exist, AMS uses the catalog information included in the portable copy to define a new catalog entry, and then it reloads the object. 

Step 2: If a catalog entry does exist, AMS verifies that the entry has been marked as exported by a previous EXPORT command with the TEMPORARY option.  If this is the case, AMS assumes that the cluster is being restored from the previously exported copy; AMS deletes the old object, defines a new catalog entry of it using the catalog information in the exported copy, and then reloads the object. 

Step 3: If a catalog entry exists, but it is not marked as having been previously exported, the IMPORT command fails.  


Syntax:

IMPORT {INFILE(ddname)  |  INDATASET(entryname)}
    {OUTFILE(ddname[/password])  |
        OUTDATASET(entryname[/password])}
    [ERASE  |  NOERASE]
    [INTOEMPTY]
    [OBJECTS((entryname
       [FILE(ddname)]
       [NEWNAME(newname)]
       [VOLUMES(volser[ volser...])])
       [(entryname...)...])]
    [PURGE  |  NOPURGE]

    [CATALOG(catname[/password])] 

Example:
//IMPORT1  JOB 'JAY MOSELEY',CLASS=A,MSGLEVEL=(1,1),MSGCLASS=A
//IDCAMS  EXEC PGM=IDCAMS,REGION=4096K                       
//BACKUP   DD  DSN=MVS802.HRTITLE.BACKUP,                    
//             UNIT=TAPE,DISP=(OLD,KEEP)                     
//SYSPRINT DD  SYSOUT=A                                       
//SYSIN    DD  *                                             
                                                             
  IMPORT INFILE(BACKUP)                                     -
         OUTDATASET(MVS802.HRTITLE.TABLE)                   -
         PURGE                                               
                                                             
/*                                                           
//                                
In addition to being used for making backup copies, the EXPORT and IMPORT commands can also be used to move VSAM clusters from one computer system to another.
The INTOEMPTY parameter specifies that the portable copy is being imported into an already existing empty cluster. 

1 comment:


  1. Air Fright
    I appreciate the ideas and this is very nice article and have great information.and NTL Logistics Plus is also Logistics Company in India provides Transportation Services in India.Thanks for great information you write it very clean. I am very lucky to get this tips from you

    ReplyDelete