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: 10872
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 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
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts DSNTIAUL driven delete IBM Tools 0
Search our Forums:

Back to Top