A batch Delete Archive Process allows you to avoid the overhead of DB2® logging, an important consideration when deleting large quantities of data from your database.
This offline Delete Archive Process has the same effect as deleting “delete after archive” data directly from the database.
In the offline Delete Archive Process, Archive compares Archive File data with data in one or more DB2 UNLOAD-compatible files to create a new file that excludes the archived data marked “delete after archive.” Archive uses matching keys as the basis of comparison for the two files. The new file, minus the deleted data, can then be loaded into the database.
The offline Delete Archive Process requires the following steps:
The format of these output files is the same as the format of the unloaded data.
The following diagram illustrates the offline Delete Archive Process:

The JCL needed to execute the offline delete utility is:
// EXEC PGM=FOPMAIN,REGION=0M,
// PARM=‘CON UTILITY subsys planname sqlid userid'
//*
//PSDFDFLT DD DSN=your.loadlib(FOPMDFLT) DEFAULT SITE OPTIONS
// DISP=SHR
//SYSPRINT DD SYSOUT=* INTERNAL ERRORS / MESSAGES
//SYSTERM DD SYSOUT=* INTERNAL ERRORS / MESSAGES
//PSTRACE DD SYSOUT=* TRACE OUTPUT
//PSDFASUM DD SYSOUT=* UTILITY SUMMARY LISTING FILE
//PSDFADIR DD SYSOUT=* DIRECTORY LISTING FILE
//PSDFAREP DD SYSOUT=* REPORT OUTPUT
//PSDFRPRT DD SYSOUT=* DELETE REPORT OUTPUT
//SYSRECnn DD DSN=input.file.name INPUT UNLOAD-COMPATIBLE FILES
// DISP=SHR
//SYSNEWnn DD DSN=output.file.name OUTPUT FILES
// DISP=OLD
//SYSDSCnn DD DSN=discard.file.name DISCARD FILES
// DISP=OLD
//SYSIN DD *
control statements
//*
A sample of this JCL is provided in the sample library as member FOPJOBUT. Unique data set names are required for SYSRECnn, SYSNEWnn, and SYSDSCnn; the offline delete utility will not overwrite the input file.
Use the OFFLINE_DELETE statement to compare data in one or more Archive Files with data in one or more DB2 UNLOAD-compatible files. This creates new UNLOAD-compatible files that exclude the archived data marked “delete after archive.” The new files, minus the deleted data, can then be loaded into the database.
Executing the OFFLINE_DELETE statement also generates a report of the Delete Process in the Delete Report listing file. Information in the report includes the input data set name, Discard File name, and names of any tables not processed.
OFFLINE_DELETE
NAME ( arc.file.name1 [, arc.file.name2, ... ] )
UNLD ( [ cid. ] tblname1, unld-ddn, discard-ddn, outunld-ddn,
format, scan [, VIEWDELETE ] )
[ UNLD ( [ cid. ] tblname2, unld-ddn, discard-ddn, outunld-ddn,
format, scan [, VIEWDELETE ] ) ]
The keywords and operands in the OFFLINE_DELETE statement are:
The following is an example of OFFLINE_DELETE statement usage:
The DETAILS and ORDERS tables, in the input UNLOAD-compatible files associated with the DDNAMES SYSREC00 and SYSREC01, are designated DAA in the Archive File FOPDEMO.ARCHIVE.FILE. The DDNAMES SYSDSC00 and SYSDSC01 designate the Discard Files, and the DDNAMES SYSNEW00 and SYSNEW01 designate the Delta Files. A matchscan is performed. To purge the designated data, specify:
OFFLINE_DELETE
NAME FOPDEMO.ARCHIVE.FILE
UNLD (DETAILS, SYSREC00, SYSDSC00, SYSNEW00,
UNLOAD, MATCHSCAN)
UNLD (ORDERS, SYSREC01, SYSDSC01, SYSNEW01,
UNLOAD, MATCHSCAN)