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

Deleting series of datasets if migrated


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

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Wed Apr 09, 2008 5:42 pm
Reply with quote

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

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
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Apr 09, 2008 5:54 pm
Reply with quote

See this link:

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
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Wed Apr 09, 2008 6:26 pm
Reply with quote

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
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Apr 09, 2008 7:05 pm
Reply with quote

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
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Apr 09, 2008 8:30 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Apr 10, 2008 11:58 am
Reply with 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
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Thu Apr 10, 2008 2:37 pm
Reply with quote

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 icon_smile.gif
Back to top
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Fri Apr 11, 2008 11:10 pm
Reply with quote

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
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Sat Apr 12, 2008 1:12 am
Reply with quote

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
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Sat Apr 12, 2008 2:01 am
Reply with quote

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
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Sat Apr 12, 2008 2:25 am
Reply with quote

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
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Sat Apr 12, 2008 4:38 am
Reply with quote

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

Code:

Data set is open


in the upper right hand corner.

Am i missing nay thing here?

Thanks
Agni.
Back to top
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Sat Apr 12, 2008 4:57 am
Reply with quote

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
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Sat Apr 12, 2008 5:42 am
Reply with quote

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
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Sat Apr 12, 2008 5:51 am
Reply with quote

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
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Sat Apr 12, 2008 6:24 am
Reply with quote

If you printed the datasets in your 3.4 display with your "P" command, you should be able to just type LIST on the command line to get the display for
3. Keep existing data set and continue with new data set

You can then go to 3.4 to edit the USERID.SPF?.LIST dataset.
Back to top
View user's profile Send private message
Srinivasa Rao

New User


Joined: 21 Jun 2005
Posts: 75

PostPosted: Mon Apr 14, 2008 4:02 pm
Reply with quote

Hi,

A simple way as I feel it can be done through ISPF instead of rexx

1) Go to ISPF 3.4
2) Specify the Higher qualifier which lists all the datasets related to the higher qualifer.
3) sort with volume
4) issue SAVE MYDSN which saves all datasets to your personal one workfile
5) exclude and delete all master catalog and non migerated datasets using exclude and delete ispf commands
6) Move the datasets and specify HDELETE before all dataset using override ISPF command.
7) Run the dataset using batch job.
8) You will find all migerated datasets are deleted.

I feel this as simple way instead of writing REXX and doing it.

If any one is confused please let me know.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Apr 14, 2008 4:27 pm
Reply with quote

A simple REXX to delete all the migrated datasets from a list and leave the non migrated / tape datasets untouched.
Code:

/* REXX */
"EXECIO * DISKR LISTIN ( STEM LST. FINIS"
DO A = 1 TO LST.0
   HDELETE "'"STRIP(LST.A)"'"
END
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Mon Apr 14, 2008 8:12 pm
Reply with quote

expat,

In the code you had posted, If am not wrong the user has to have a LIST dataset which would have the list of all the dataset that needs to be HDeleted.

In my earlier post on this topic i have posted a code whcih accepts wildcards and removes the hassle of creating the LIST dataset if the no is huge.

I have not tested that and hope it works. Please correct me if am wrong.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Apr 15, 2008 9:23 am
Reply with quote

Yes, I saw, but wild cards can be dangerous - he says from bitter experience.
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 Deleting a Tape file JCL & VSAM 14
No new posts CA7 deleting files in steps after job... CA Products 4
No new posts Merging 2 datasets into one DFSORT/ICETOOL 1
No new posts How Can I Recall a Migrated Data Set ... PL/I & Assembler 3
No new posts PL/I, VB Datasets and the RDW PL/I & Assembler 4
Search our Forums:

Back to Top