How to automate to delete multiple GDG generations of different jobs on daily basis?

318 Views Asked by At

I am working in a environment where Batch jobs which triggers in daily basis are A to Z– total 24 jobs(Just an example)

All these jobs create QUESTION.XXXXXXXX.HELPME.G0002V000 (Where XXXXXXX=Jobnames(A_Z)) once the batch process is completed.

Case1: QUESTION.XXXXXXXX.HELPME.G0002V000 will be deleted automatically if the batch run is completed successfully.

Case2: on the other hand, If the job is failed, we need to delete QUESTION.XXXXXXXX.HELPME.G0002V000 manually.

Since, we are having huge number of batch jobs and plenty of them fail on daily basis. It’s really painful to delete all them every day.

I want to create a system which can help me in deleting all the generation files in one PS file or .txt files(failed jobs GDG generations) in one shot like submitting one JCL or executing one REXX component.

Note: I cant code this in my JCL because of few other constrains.

1

There are 1 best solutions below

0
Bruce Martin On

A couple of options

  1. Use a BackUp-Delete option in DFDSS or what ever it is called now. Has the advantage of creating a backup of whatever is deleted. You can use generics in DFDSS
  2. If you reference the GDG Base QUESTION.XXXXXXXX.HELPME in JCL it will pickup every generation. You can use DISP=(OLD,DELETE) (note if there is no generation you get a JCL error.
  3. Use Rexx to check/delete

To do it in JCL

//  PGM=IEFBR14
//C  DD DSN=QUESTION.XXXXXXXX.HELPME(+1)....
//*
//  PGM=IEFBR14
//D  DD DSN=QUESTION.XXXXXXXX.HELPME,DISP=(OLD,DELETE)