Monday, September 26, 2011

DB2: Sample unload job using ADMF utility DSNUTILB


The below job unloads an entires database. If you want to unload a specific table space, then you will have to change the LISTDEF accordingly.

// DSNUPROC EXEC PGM=DSNUTILB,REGION=4096K,
//         PARM='DB0T,UNLOAD'
//UTPRINT  DD  SYSOUT=*          
//SYSPRINT DD  SYSOUT=*          
//SYSPUNCH DD  *                 
//SYSIN    DD  *                 
  LISTDEF UNLDLIST INCLUDE TABLESPACES TABLE MYDB.*    
                                                                
  TEMPLATE UNLDDS   DSN MYDSN.TP.&DB..&TS..UNLDS.D&DT.         
             UNIT TAPE90 DISP (NEW,CATLG,CATLG) RETPD=60        
  TEMPLATE PUNCHDS  DSN MYDSN.SDA.&DB..&TS..PNDS.D&DT.          
             UNIT SYSDA  DISP (NEW,CATLG,CATLG) SPACE CYL       
                                                                
  UNLOAD LIST UNLDLIST                                          
      PUNCHDDN PUNCHDS                                           
        UNLDDN  UNLDDS                                          
        SHRLEVEL CHANGE ISOLATION UR                            
//*

Explanation of control card

The LISTDEF parameter defines the list of table spaces. In this case table space is coded as "MYDB.*" which means all the table spaces that starts with MYDB.

There are two TEMPLATE statements. The first TEMPLATE statement defines the template dataset name for the unload dataset and the second TEMPLATE statement defines the template dataset name for the SYSPUNCH card. The symbloc fields &DB,&TS,&DT will be substituted with the actual database name, tablespace name and date respectively when the unload/SYSPUNCH datasets are created. 

The LIST parameter in the UNLOAD statement Identifies the name of a list of objects that are defined by a LISTDEF utility control statement. PUNCHDDN parameter specifies the template name that defines data set names that are to receive the LOAD utility control statements that the UNLOAD utility generates. The UNLDDN parameter specifies the template name that defines the data set names into which the data is to be unloaded.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.