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

How to delete 'N' no of datasets at a time in jcl?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Priya_1985

New User


Joined: 06 Oct 2008
Posts: 3
Location: Hyderabad

PostPosted: Fri Oct 17, 2008 3:16 pm
Reply with quote

Hi! This is your First post in our Forums! So please be sure to 1) Use meaningful and descriptive Topic Title 2) Try to post your query in the relevant forum category 3) Make sure your query is not already posted and solved in our forums, Use the Search facility and avoid Reposts! If you are following the above rules, delete this message and post your query here!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Oct 17, 2008 3:22 pm
Reply with quote

One DD for each, unless you want to use IDCAMS, or REXX, or possibly other utilities.

Please explain what you want to do, very clearly.
Back to top
View user's profile Send private message
Priya_1985

New User


Joined: 06 Oct 2008
Posts: 3
Location: Hyderabad

PostPosted: Fri Oct 17, 2008 3:31 pm
Reply with quote

Hi

sry i will post clearly my question
i want to delete suppose 100 PDS i will be giving delete infront of them..is there any command at a time it can delete all the datasets.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Fri Oct 17, 2008 3:33 pm
Reply with quote

look at the access method services manual ( IDCAMS ) and read the delete section
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Oct 17, 2008 3:41 pm
Reply with quote

Any dsn pattern ?
Back to top
View user's profile Send private message
ashishsr123

New User


Joined: 06 May 2008
Posts: 33
Location: Chennai

PostPosted: Fri Oct 17, 2008 3:44 pm
Reply with quote

We can use IEFBR14.

Then
Code:

DD DSN=<DSN NAME>,
      DISP=(OLD,DELETE,DELETE),
      SPACE=(TRK,(1,1),RLSE)


Code this for all Datasets you have
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Oct 17, 2008 3:49 pm
Reply with quote

ashishsr123

Unfortunately not the best method. This means that you will be coding 3 lines per dataset instead of one line per dataset. So immediately your workload has trebled.

Also, DISP=OLD - not the best choice - so what happens if some of the datasets are missing ? immediate JCL error.

DISP=(MOD,DELETE,DELETE) is far better because it will not fail if the dataset does not exist.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Sat Oct 18, 2008 2:05 am
Reply with quote

And if the DSNs don't follow a patteren this type of work is really a pain ...
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sat Oct 18, 2008 4:33 am
Reply with quote

Hi,

one problem with DISP=(MOD,DELETE,DELETE) is that if the dataset is migrated it will be recalled first before it is deleted.

IDCAMS is smart enough to know that if the dataset is migrated it will issue a HDELETE instead.


Gerry
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Tue Oct 21, 2008 12:53 pm
Reply with quote

Hi Priya,
if the DSNs are of simillar pattern then u can delete them in a single idcams step. Let us know the datasets are of simillar patterns.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Tue Oct 21, 2008 1:06 pm
Reply with quote

samuel_Inba wrote:
Hi Priya,
if the DSNs are of simillar pattern then u can delete them in a single idcams step. Let us know the datasets are of simillar patterns.

IDCAMS generic only permits the use of one * wildcard which must replace a whole level, so may not delete all of the required datasets within a given pattern

and from the fine manual
Quote:

Here is an example of how generic level DELETE works given the following data sets:

1) AAA.BBB.CCC.DDD
2) AAA.BBB.CCC.DDD
3) AAA.BBB.CCC.DDD.EEE
4) AAA.BBB.CCC
DELETE AAA.* results in the deletion of no data sets.
DELETE AAA.BBB.* results in the deletion of data set #4
DELETE AAA.BBB.*.DDD results in the selection of data sets #1 and #2
DELETE AAA.BBB.*.DDD.EEE results in the deletion of data set #3.

When a generic level name is specified, only one qualifier can replace the asterisk (*).
Back to top
View user's profile Send private message
sachin_kaushik84

New User


Joined: 03 Oct 2008
Posts: 23
Location: noida

PostPosted: Tue Oct 21, 2008 2:41 pm
Reply with quote

this is noit a good practice to delete the N number of dataset as if any one dataset is migrated or not present then it will create a problem for u...
so the best practice isto use IDCAMS with
//step1 exec pgm=idcams
// delete QQQ.* (QQQ is the start name of ur DSN )
i think this will work instead of using IEFBR14.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Tue Oct 21, 2008 2:50 pm
Reply with quote

sachin_kaushik84

Did you test your code before posting ?
Did you read the restrictions of IDCAMS generic before posting - see previous post above
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Tue Oct 21, 2008 3:00 pm
Reply with quote

And I'll ignore the two slashes (//) also before the "DELETE".. icon_wink.gif

..tough public..ya.. icon_smile.gif
Back to top
View user's profile Send private message
sachin_kaushik84

New User


Joined: 03 Oct 2008
Posts: 23
Location: noida

PostPosted: Tue Oct 21, 2008 3:51 pm
Reply with quote

what do you try to figure out here i am not sure just the jcl means
//step1 exec pgm=idcams
//sysin dd *
delete (dataset name)
/*
//
i think this is ok icon_razz.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts JES datasets IO Error ABENDS & Debugging 3
No new posts Concatenate 2 input datasets and give... JCL & VSAM 2
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts To get the the current time DFSORT/ICETOOL 13
Search our Forums:

Back to Top