Monday, September 26, 2011

DB2: Delete all the ROWS from a table using DSNUTILB


Loading the table with empty or DUMMY file will delete all the rows from a table. Instead of deleting rows from the table, DB2 will delete and redefine the underlying LDS dataset, thus it drops all the existing rows from a table.

//STEP010  EXEC PGM=DSNUTILB,REGION=0M,                                
//            PARM='DBXT,LOAD'                                      
//STEPLIB  DD DSN=DB2.DBXT.SDSNEXIT,DISP=SHR
//         DD DSN=DB2.DBXT.SDSNLOAD,DISP=SHR                           
//SYSIN    DD *
LOAD DATA REPLACE                      
 LOG NO  NOCOPYPEND                    
 STATISTICS TABLE INDEX UPDATE ALL     
INTO TABLE MY.TAB
//*
//SYSREC   DD DUMMY
//SYSDISC  DD DSN=…
//            DISP=(,CATLG),SPACE=(CYL,(9,9),RLSE)                     
//SYSMAP   DD DSN=…
//            DISP=(,CATLG),SPACE=(CYL,(9,9),RLSE)                     
//SYSDISC  DD DSN=…
//            DISP=(,CATLG),SPACE=(CYL,(9,9),RLSE)                     
//SYSUT1   DD DSN=…
//            DISP=(,CATLG),SPACE=(CYL,(9,9),RLSE)                     
//SORTOUT  DD DSN=…
//            DISP=(,CATLG),SPACE=(CYL,(9,9),RLSE)                     
//SORTWK01 DD SPACE=(CYL,(100,100))                   
//SORTWK02 DD SPACE=(CYL,(100,100))                   
//SORTWK03 DD SPACE=(CYL,(100,100))           
//SORTWK04 DD SPACE=(CYL,(100,100))           
//SYSPRINT DD SYSOUT=*                                         
//UTPRINT  DD SYSOUT=*                                         

No comments:

Post a Comment

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