IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Rexx Program to delete datasets


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Naresh chinthaneppu

New User


Joined: 21 Jun 2007
Posts: 11
Location: pune

PostPosted: Wed Aug 22, 2007 1:56 pm
Reply with quote

Hi,

i want to delete all the datasets starting with some string CHIRU.there are 1500 datasets starting with CHIRU.i can not do it manually typing D against each dataset.

similerway i want to delete all datasets of the format NAGA*.AB001234.*
Back to top
View user's profile Send private message
jobin

New User


Joined: 20 Feb 2007
Posts: 9
Location: Bangalore

PostPosted: Wed Aug 22, 2007 2:15 pm
Reply with quote

List all the datasets starting with CHIRU using
"LISTC LEVEL('CHIRU')" into an array.

Regarding the getting specific pattern do a sort on the list. Have a look at <a href="http://ibmmainframes.com/viewtopic.php?t=611&highlight=list+datasets+starting">this post </a>

Loop through the array and perform "TSO" "DLETE '"FILE_NAME"'" for each datasets.
Back to top
View user's profile Send private message
Maverick34

New User


Joined: 19 Aug 2007
Posts: 4
Location: UK

PostPosted: Wed Aug 22, 2007 2:24 pm
Reply with quote

why not use DF/dss to do this?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Aug 22, 2007 2:55 pm
Reply with quote

Unfortunately Dfdss does not cater for tape or migrated datasets
Back to top
View user's profile Send private message
jobin

New User


Joined: 20 Feb 2007
Posts: 9
Location: Bangalore

PostPosted: Wed Aug 22, 2007 4:50 pm
Reply with quote

Try this following one

Code:
/* rexx */
/* list all the datasets starting with nbdlzsa in filel. array */
j = 0
k = 0
x = outtrap(mbrs.)
"LISTC LEVEL('NBDLZSA')"
do i = 1 to mbrs.0
   if pos('IN-CAT',mbrs.i) > 0 then nop
   else do
      parse var mbrs.i . '-------' mbrs.i
      mbrs.i = strip(mbrs.i)
      j = j + 1
      filel.j = mbrs.i
   end
end
/* say you want to have only datasets nbdlzsa.*.AR.* to be deleted */
do i = 1 to j
   parse var filel.i . '.' . 'AR.' rest
   if rest <> '' then do
      k = k + 1
      finall.k = filel.i
   end
end
/* delete the files listed in finall. array */
do i = 1 to k
    "delete '"finall.i"'"
end
exit


Hope it helps
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Aug 22, 2007 5:25 pm
Reply with quote

Just use the TSO command DEL to delete the datasets. It works fine in my shop.

TSO DEL 'HLQ.ARU.DATAST.*'
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Using API Gateway from CICS program CICS 0
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts DELETE SPUFI DB2 1
Search our Forums:

Back to Top