|
|
| Author |
Message |
Agni
Active User
Joined: 22 Nov 2007 Posts: 75 Location: Chennai
|
|
|
|
All,
I have a requirement to delete the datasets in production. There are around 600 datasets to be deleted. Also before deleting we need to check whether it is migrated or not. We have to delete those datasets if they are migrated. Otherwise should not delete. I found a post in REXX to delete the series of datasets. Please find the link for the same below
http://ibmmainframes.com/viewtopic.php?t=9969&highlight=deleting+datasets
I checked that in test region by giving series of datasets as below and it worked fine.
XXX.YYYY1.ZZZ1
XXX.YYYY2.ZZZ2
XXX.YYYY3.ZZZ3
XXX.YYYY4.ZZZ4
XXX.YYYY5.ZZZ5
Now i need to add a check that the above datasets should be deleted only if they are migrated.
Agni |
|
| Back to top |
|
 |
References
|
Posted: Wed Apr 09, 2008 5:42 pm Post subject: Re: Deleting series of datasets if migrated |
 |
|
|
 |
Moved: Wed Apr 09, 2008 5:48 pm by superk From CLIST & REXX to SMS & VSAM |
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 271 Location: Jacksonville, FL
|
|
|
|
See this link:
http://ibmmainframes.com/viewtopic.php?t=29228
There are instructions for putting all the datasets to be deleted into a file, running a REXX, and receiving information about whether the datasets are migrated or not. |
|
| Back to top |
|
 |
Agni
Active User
Joined: 22 Nov 2007 Posts: 75 Location: Chennai
|
|
|
|
Thanks cpuhawg. I think i misinterpreted my requirement. Let me repharase it. I want to delete the series of datasets if they are migrated. If the dataset is not migrated it should not be deleted. I don't need any other details of the dataset.
Thanks
Agni |
|
| Back to top |
|
 |
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 271 Location: Jacksonville, FL
|
|
|
|
I understand your requirement. What the REXX program will do will analyze all 600 datasets. If it is not migrated, it will give you dataset information. If it is migrated, it will state the dataset is migrated. Once the REXX has run, you can view the SYSTSPRT file:
On the example below, you will see HLQ.PRIVILEG.JCLX dataset is not migrated and the HLQ.AUDIT.GROUP.DATASET dataset is migrated:
| Code: |
DATA SET NAME: HLQ.PRIVILEG.JCLX
Volume serial: XYZATQ
Device type: 3390, (trks/cyl 15, blks/trk 2)
Organization: PS
Record format: FB
Record length: 80
Block size: 27920
Allocation units: TRACK
Space allocated: 3
Space used: 3
Primary allocation: 3
Secondary allocation: 75
Extents used: 1
Creation date: 2008/084
Expiration date: 0
HLQ.AUDIT.GROUP.DATASET IKJ58425I DATA SET MIGRATED TO NON-DASD DEVICE.
|
You can then edit the SYSTSPRT dataset to find all migrated datasets, isolated them from the others, and used the HDELETE command to delete the migrated datasets. |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1003 Location: Chennai - India
|
|
|
|
Agni,
| Quote: |
| You can then edit the SYSTSPRT dataset to find all migrated datasets, |
Try this after getting the SYSTSPRT dataset.
1) Check where all the word 'MIGRATED' appears in that dataset.
2) If it appears only in the line where the migrated dataset name is present, then
you read the SYSTSPRT dataset into a stem and then using POS parameter try extracting the dataset name alone into a different dataset.
Once this is obtained you can very well issue the HDELETE command. |
|
| Back to top |
|
 |
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 2962 Location: Brussels once more ...
|
|
|
|
| Well, if you issue a HDELETE command for every dataset. the ones that are not migrated will not be HDELETE'd and will remain on DASD |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1003 Location: Chennai - India
|
|
|
|
Expat,
| Quote: |
| Well, if you issue a HDELETE command for every dataset. the ones that are not migrated will not be HDELETE'd and will remain on DASD |
Good piece of information. Thanks.
Agni,
Now your work is simple  |
|
| Back to top |
|
 |
Agni
Active User
Joined: 22 Nov 2007 Posts: 75 Location: Chennai
|
|
|
|
Hi cpuhawg,
Should i need to copy all the 600 datasets and paste it in the flat file? If it is only 600 datasets i can manage some how and paste it in the flat file, in case if the number of file is more, how can we do this? Please advise.
Thanks
Agni. |
|
| Back to top |
|
 |
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 271 Location: Jacksonville, FL
|
|
|
|
The 80 byte file input to the REXX can contain all 600 full dataset names including any GDG versions (don't use (0)). The number of datasets does not matter. It can be any number of datasets.
The REXX will go through each dataset and provide either dataset attributes (if not migrated) or state that it is migrated. The SYSTSPRT output DD statement will contain the messages about each dataset.
You can even remove the following lines from the REXX (if you don't really need any dataset information) which should cut down on your output.
| Code: |
say;
say ' Volume serial: ' sysvolume
say ' Device type: ' sysunit',',
'(trks/cyl 'systrkscyl', blks/trk 'sysblkstrk')'
say ' Organization: ' sysdsorg
say ' Record format: ' sysrecfm
say ' Record length: ' syslrecl
say ' Block size: ' sysblksize
say ' Allocation units: ' sysunits
say ' Space allocated: ' sysalloc
say ' Space used: ' sysused
say ' Primary allocation: ' sysprimary
say ' Secondary allocation: ' sysseconds
say ' Extents used: ' sysextents
say ' Creation date: ' syscreate
say ' Expiration date: ' sysexdate
|
|
|
| Back to top |
|
 |
Agni
Active User
Joined: 22 Nov 2007 Posts: 75 Location: Chennai
|
|
|
|
Hi cpuhawg,
I got what you told in the previous post bu tmy question was like how can i copy and paste if number of dataset is more say for example 2000. Is there any way like using wild characters like as follows?
XXX.YYYY*.ZZZ*
Thanks
Agni |
|
| Back to top |
|
 |
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 271 Location: Jacksonville, FL
|
|
|
|
The REXX setup cannot accept wild cards. I would suggest going to option 3.4 and put in your wild carded dataset. Verify it pulls up the datasets you would like to check. Now back out one screen (back to 3.4). Put a P (for print dataset set list), press enter, and you should see Data Set List Printed in the upper right corner of the screen.
Now enter LIST next to OPTION ===> and press enter. You should see:
| Code: |
Specify Disposition of List Data Set
Command ===>
List Data Set (USERID.SPF?.LIST) Disposition:
Process Option . . . . 1. Print data set and delete
2. Delete data set without printing
3. Keep existing data set and
continue with new data set
|
Enter 3 (Keep existing dataset and continue with new dataset) next to Process Option. You should see LIST data set kept in the upper right hand corner. Now press F1. It will show you:
USERID.SPF?.LIST has been kept.
Now go to option 3.4, edit USERID.SPF?.LIST in ISPF until you have all the datasets you want checked. Scut and paste these in the 80 byte dataset to be input to the REXX started in position 1. |
|
| Back to top |
|
 |
Agni
Active User
Joined: 22 Nov 2007 Posts: 75 Location: Chennai
|
|
|
|
Hi cpuhawg,
| Quote: |
You should see LIST data set kept in the upper right hand corner. Now press F1. It will show you:
USERID.SPF?.LIST has been kept.
|
After giving option 3 and when i pressed F1 i got a screen as follows
| Code: |
Tutorial ---------- List and Log Commands - Command Panels ---------- Tutorial
Option ===>
|
Moreover when i gave the USERID.SPF?.LIST in 3.4 option, am getting
in the upper right hand corner.
Am i missing nay thing here?
Thanks
Agni. |
|
| Back to top |
|
 |
Agni
Active User
Joined: 22 Nov 2007 Posts: 75 Location: Chennai
|
|
|
|
Hi cpuhawg
If you give any solution, i will work on that on Tuesday. Three days holiday for me:) Am in office still. I am leaving now. Thanks very much
for all your help.
Cheers
Agni |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1003 Location: Chennai - India
|
|
|
|
Agni,
| Quote: |
Hi cpuhawg,
Is there any way like using wild characters like as follows?
XXX.YYYY*.ZZZ*
|
Yes, REXX accepts wildcards. |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1003 Location: Chennai - India
|
|
|
|
Agni,
Check the below code. This code accepts the wildcard and then deletes all the migrated datasets.
| Code: |
HLQ = 'XXX.YYYY*.ZZZ*'
HLQ = STRIP(HLQ)
ADDRESS ISPEXEC "LMDINIT LISTID(TEMPLIST) LEVEL("HLQ1")"
DO FOREVER
ADDRESS ISPEXEC
"LMDLIST LISTID(&TEMPLIST) OPTION(LIST) DATASET(DSVAR) STATS(YES)"
IF RC <> 0 THEN LEAVE
ADDRESS TSO "HDELETE '"DSVAR"'"
DSVAR = ''
END
ADDRESS ISPEXEC "LMDFREE LISTID(&TEMPLIST)"
|
|
|
| Back to top |
|
 |
|
|