View previous topic :: View next topic |
Author |
Message |
priyam Beginner
Joined: 05 Jul 2006 Posts: 16 Topics: 12
|
Posted: Fri Oct 19, 2007 6:11 am Post subject: REXX Tool - To delete the datasets created by a job |
|
|
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 |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Oct 19, 2007 2:15 pm Post subject: |
|
|
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 |
|
 |
expat Intermediate

Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Sat Oct 20, 2007 2:08 am Post subject: |
|
|
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 |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Sat Oct 20, 2007 7:23 am Post subject: |
|
|
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  _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Sun Oct 21, 2007 2:50 am Post subject: |
|
|
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 |
|
 |
|
|