MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

REXX Tool - To delete the datasets created by a job

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
priyam
Beginner


Joined: 05 Jul 2006
Posts: 16
Topics: 12

PostPosted: Fri Oct 19, 2007 6:11 am    Post subject: REXX Tool - To delete the datasets created by a job Reply with quote

Hi all,

Am new to REXX. I want to develop a REXX tool, which creates a delete step in the beginning of the JCL for all the datasets that are newly created in that JCL. (DISP=(NEW, CATLG)).
This is mainly for testing purpose. Because, we would run the same job many times and every time we need to go and delete the datasets manually. To avoid this, i want to create a tool.

For e.g.

My JCL is having three steps, in which each step is creating two output files. So if i give "DELNEW" in the command line it should create the delete step at the beginning of the JCL (after JOB card) with all 6 files.

If anyone have the code already, it would be very helpful if you provide the code.

Thanks in advance!!!
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Fri Oct 19, 2007 6:30 am    Post subject: Reply with quote

Check the below link. It has the solution

http://www.mvsforums.com/helpboards/viewtopic.php?t=8456&highlight=rexx+tool+delete+datasets+created+job
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Oct 19, 2007 2:15 pm    Post subject: Reply with quote

Much though I love REXX and I contributed to the thread in the link all you need here is an IEFBR14 step at the fron of the job to delete all datasets created in the job or before each step that creates a dataset to delete thos particular datasets.
Code:

//HOUSEKEEP EXEC PGM=IEFBR14
//DEL001     DD DSN=A.DSN,
//              DISP=(MOD,DELETE,DELETE),
//              SPACE =(TRK,0),
//              UNIT=SYDA


You may not need the SPACE and UNIT depending on your shop's SMS setup.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Sat Oct 20, 2007 2:08 am    Post subject: Reply with quote

Or good old IDCAMS will do just as well
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Sat Oct 20, 2007 7:23 am    Post subject: Reply with quote

Except with IDCAMS, if you are running a procedure, your control cards are hidden away in a dataset somewhere whereas with BR14 what it is dealing with is in plain view so you know which files it is cleaning up and you can check that all the required files are being deleted without leaving the procedure. Still doesn't stop me getting the dataset names wrong though Mr. Green
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Sun Oct 21, 2007 2:50 am    Post subject: Reply with quote

And IEFBR14 does not do anything. It is the JCL interpreter that does the work so this method is more efficient.

I always get a kick out of all the references to IEFR14 doing allocations and the JCL that gets posted here with things like //SYSPRINT, //SYSOUT, //SYSIN DD DUMMY and the like for IEFBR14 steps because IEFBR14 is nothing more than an SR 15,15; BR 14 (or maybe XR).

You can get the same results for allocations/deletions within JCL by specifying a nonexistent program in the EXEC PGM=xxx statement. Sure, you'll get an ABEND 806, but the allocations or deletions will work because they are done before the program is invoked (at least with JES2, though I suspect JES3 will do the same).
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group