Example 2: Deleting entries from the HISTORY data set

This example contains JCL for deleting entries from the HISTORY data set.

In this example, entries in the HISTORY data set are listed out before and after entries are deleted, to make sure that the specified entries are deleted.

The JCL example specifies the deletion of:

  • All entries of the database name DB01 from January 1 in 2021 to the current date
  • Each entry of the ddname DB02DD01 and DB02DD02 of database DB02 which was created most recently
  • All entries of the ddname DB03DD01 of database name DB03 created in March 2021
  • Entries of the ddname DB04DD01 of database name DB04 that are created more than 100 days ago

DISP=OLD must be used for the HISTORY DD statement.

Figure 1. DB Historical Data Analyzer example 2: Deleting entries from a HISTORY data set
//*********************************************
//** DELETING HISTORY DATA SET ENTRIES       **
//*********************************************
//DELETE   EXEC  PGM=FABGHIST
//STEPLIB  DD DSN=HPS.SHPSLMD0,DISP=SHR
//HISTORY  DD DSN=HIST.HISTORY,DISP=OLD
//HISTPRT  DD SYSOUT=A
//HISTMSG  DD SYSOUT=A
//SYSUDUMP DD SYSOUT=A
//HISTIN   DD  *
 PROC TYPE=LIST      ** LIST CONTENTS BEFORE DELETION
 ENDPROC
 PROC TYPE=DELETE    ** DELETE HISTORY DS ENTRIES
   DATABASE DB=DB01,DD=ALL,FROM=01012021
   DATABASE DB=DB02,DD=DB02DD01
   DATABASE DB=DB02,DD=DB02DD02
   DATABASE DB=DB03,DD=DB03DD01,FROM=03012021,TO=03312021
   DATABASE DB=DB04,DD=DB04DD01,KEEP=100
 ENDPROC
 PROC TYPE=LIST      ** LIST CONTENTS AFTER DELETION
 ENDPROC
/*