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

Rexx code to delete dataset


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

New User


Joined: 14 Aug 2011
Posts: 24
Location: india

PostPosted: Mon Feb 17, 2014 10:27 am
Reply with quote

Hi All,

I need some help with rexx code which would delete a dataset based on HLQ. I have to reprot out datasets which the program attempted to delete it and was not successful. In the report I have to reason out why it was not deleted.

Is there a way to find out the reason why dataset was not deleted (Retrun code ??).
Back to top
View user's profile Send private message
TheMFKid

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Mon Feb 17, 2014 11:17 am
Reply with quote

Santosh,

You can use LMDLIST function to list dataset names based on HLQ. Alternatively you can use "LISTCAT LVL" to list datasets based on HLQ.
Use DELETE to delete a dataset using REXX and if you want to capture if dataset is deleted or not(with error message), you can use OUTTRAP on DELETE statement.

Hope this helps icon_smile.gif
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Mon Feb 17, 2014 11:18 am
Reply with quote

1. Use LISTCAT to gather list of dataset based on HLQ. Use OUTTRAP function.
2. TSO DEL command to delete one by one (include business conditions before delete)
3. You can always get 'RC' from REXX.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10771
Location: italy

PostPosted: Mon Feb 17, 2014 1:06 pm
Reply with quote

the issue has been discussed quite a few times
and the general consensus is not to waste time reinventing the wheel ...

and use IDCAMS for a qualifier only approach
or use DFDSS to filer on additional criteria ( for example reference date )

search the forum with "DFDSS DELETE"
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 rexx pgm to create multiple ps file IBM Tools 7
No new posts IEF085I REGION UNAVAILABLE,ERROR CODE... Java & MQSeries 0
No new posts Mainframe batch Job or REXX to get VT... CLIST & REXX 7
No new posts how to list the number of backup data... JCL & VSAM 3
No new posts calling OMEGAMON from REXX CLIST & REXX 3
Search our Forums:

Back to Top