Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Rexx Program to delete datasets

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Rexx Program to delete datasets
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    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Aug 22, 2007 2:55 pm    Post subject:
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    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Wed Aug 22, 2007 5:25 pm    Post subject: Reply to: Rexx Program to delete datasets
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts REXX compiled via RXTCOMP sergeyken CLIST & REXX 7 Tue Feb 07, 2017 9:41 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us