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



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

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

Postby Okonita » Mon Jan 28, 2013 9:33 pm

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:
//UTL1000U EXEC PGM=IEFBR14
//DD01    DD DSN=GO1.OGADM31.ATEMPFIL,DISP=SHR
//*

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

Thanks
Okonita
 
Posts: 10
Joined: Thu Dec 13, 2007 4:53 am
Has thanked: 0 time
Been thanked: 0 time

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

 

Re: How can I delete disk files based on names in another fi

Postby Akatsukami » Mon Jan 28, 2013 9:44 pm

IEFBR14 does nothing but a branch to the (return) address contained in register 14, hence the name. It will not interpret or reformat data included in a data set; indeed, it will do nothing to it (the dispositive processing is done by MVS).

If your data set contains good JCL, you could make it a member of a private proclib and add it to your IEFBR14 step via the INCLUDE statement. Alternatively, you could use the tool of your choice (I'd use Rexx) to create IDCAMS control statements that delete those data sets.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: How can I delete disk files based on names in another fi

Postby NicC » Tue Jan 29, 2013 1:39 am

use the tool of your choice (I'd use Rexx) to create IDCAMS control statements that delete those data sets

or just convert the data into idcams delete statements by hand and feed the dataset into idcams via sysin. No need to go writing a rexx program to do a simple 1-off task. Using ISPF editor commands it will be much quicker to do the change than designing, writing and debugging the program.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: How can I delete disk files based on names in another fi

Postby Akatsukami » Tue Jan 29, 2013 1:55 am

NicC wrote:
use the tool of your choice (I'd use Rexx) to create IDCAMS control statements that delete those data sets

or just convert the data into idcams delete statements by hand and feed the dataset into idcams via sysin. No need to go writing a rexx program to do a simple 1-off task. Using ISPF editor commands it will be much quicker to do the change than designing, writing and debugging the program.

I'd understood from
I need to delete many files each time I run a particular job

that this task would be repeated many times, perhaps indefinitely. Could be that I misunderstood, of course.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: How can I delete disk files based on names in another fi

Postby Okonita » Tue Jan 29, 2013 10:26 pm

Hi all,

I just tried the IDCAMS suggestion but I am getting the following error:

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

What am I doing wrong here? What is VSAM CATALOG RETURN CODE IS 8 - REASON CODE IS IGG0CLEG-42? Of course I am going to research this further but your answers are always a pleasure to read...

Thanks
Okonita
 
Posts: 10
Joined: Thu Dec 13, 2007 4:53 am
Has thanked: 0 time
Been thanked: 0 time

Re: How can I delete disk files based on names in another fi

Postby steve-myers » Tue Jan 29, 2013 10:42 pm

I'm not going to research the codes in the messages for you, but I will tell you the 3 most common errors. You can do the donkey work, which you should have done before posting here.
  • The data set name is not cataloged.
  • The data set name is cataloged, but the data set does not exist on the volume where it is cataloged.
  • The data set is cataloged on a tape volume.
What you have to do depends on the error that you determine after analyzing the codes in the message.
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: How can I delete disk files based on names in another fi

Postby Okonita » Wed Jan 30, 2013 1:06 am

Steve-myers,
THank you for that information. I did look it up and yes it does exist on my catalog but no entry in the VTOC...something to that effect. It appears I have to add a few extra (optional parms) to get it to work like NONVSAM and PURGE.

That begs the question, why do they call it optional parameters...oh, well

Again Thanks
Okonita
 
Posts: 10
Joined: Thu Dec 13, 2007 4:53 am
Has thanked: 0 time
Been thanked: 0 time

Re: How can I delete disk files based on names in another fi

Postby Robert Sample » Wed Jan 30, 2013 1:24 am

They are optional parameters becasue the command does not require them. However, depending upon what you are wanting to do, those "optional" parameters may not be optional. Deleting a VSAM data set, for example, does not require the NONVSAM parameter -- hence NONVSAM is optional and not required by the IDCAMS DELETE -- yet if you want to delete a data set that is not VSAM, that NONVSAM becomes mandartory not optional.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: How can I delete disk files based on names in another fi

Postby Okonita » Wed Jan 30, 2013 5:56 pm

Thank you very much Mr. Sample. Response much appreciated.
Okonita
 
Posts: 10
Joined: Thu Dec 13, 2007 4:53 am
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post