Link to home
Start Free TrialLog in
Avatar of Enyinnaya
EnyinnayaFlag for United States of America

asked on

How can I delete disk files based on names in another file?

Hello all,

I need to delete many files each time I run a particular job.
What I have tried and will like to do is to create a file which contains names of the files that I want to delete.

For example, the input file will look like the following:

Input_File:

GO1.OSCR.D1UNL.GO1DDEV1.GO1SCAM1.PUNCH,DISP=(OLD,DELETE,DELETE)
GO1.OSCR.D1UNL.GO1DDEV1.GO1SCJR1.PUNCH,DISP=(OLD,DELETE,DELETE)
GO1.OSCR.D1UNL.GO1DDEV1.GO1SDNF1.PUNCH,DISP=(OLD,DELETE,DELETE)
GO1.OSCR.D1UNL.GO1DDEV1.GO1SGAJ1.PUNCH,DISP=(OLD,DELETE,DELETE)
GO1.OSCR.D1UNL.GO1DDEV1.GO1SGCT1.PUNCH,DISP=(OLD,DELETE,DELETE)
...

I tried the following JCL which ran fine but did not delete the datasets I am interested in:
//JOBCARD
//UTL1000U EXEC PGM=IEFBR14
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//DD01 DD DSN=GO1.OGADM31.ATEMPFIL,DISP=SHR
//SYSIN DD DUMMY
//*

Can anyone suggest a way to accomplish what I need to get done?
I will greatly appreciate any help that I can get.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of giltjr
giltjr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Enyinnaya

ASKER

I just tried the IDCAMS suggestion and it did not work. I got the following error for all the files I wanted to delete:

 DELETE GO1.FDBEV1.OSCR.D1UNL.GO1SCAM1.PUNCH
IDC3012I ENTRY GO1.FDBEV1.OSCR.D1UNL.GO1SCAM1.PUNCH NOT FOUND
IDC3009I ** VSAM CATALOG RETURN CODE IS 8 - REASON CODE IS IGG0CLEG-42
IDC0551I ** ENTRY GO1.FDBEV1.OSCR.D1UNL.GO1SCAM1.PUNCH NOT DELETED
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 8

Is there something that I am doing wrong here?

Thanks
That tells me the data set either does not exist or is not cataloged.
I've requested that this question be closed as follows:

Accepted answer: 0 points for Enyinnaya's comment #a38831708

for the following reason:

Again thank you