DB2 can do it for you if you don't need your history longer than 30 days.
Number of database backups to retain (NUM_DB_BACKUPS) = 30
Recovery history retention (days) (REC_HIS_RETENTN) = 30
Auto deletion of recovery objects (AUTO_DEL_REC_OBJ) = ON
These settings will remove Entries in the database Historie after 30 Days. If AUTO_DEL_REC_OBJ is set to ON, DB2 will also remove the files (in the filesystem, in TSM or ...). It will also take care of the archive logfiles and will remove logfiles older than the latest backup.