Delete Multiple datasets
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> TSO and ISPF

#1: Delete Multiple datasets Author: psridhar PostPosted: Tue Apr 12, 2005 7:44 am
    —
Hi

Can anybody help me in deleting multiple datasets through REXX. My requirement is as follows.

I will be having datasets like

APPCOM.MFA.FILE1
APPCOM.MFA.FILE2
APPCOM.MFA.FILE3
APPCOM.MFA.FILE4 etc...

My input to the REXX tool will be APPCOM.MFA.*

Then it should delete all the above datasets. Is it possible by REXX. If so, please help me.

Thanks in advance
Sridhar P

#2:  Author: kolusuLocation: San Jose PostPosted: Tue Apr 12, 2005 7:59 am
    —
Sridhar,

You can use ADRDSSU utility to delete the datasets. Here is a sample JCL.

Code:

//STEP0100 EXEC PGM=ADRDSSU                                 
//SYSPRINT DD SYSOUT=*                                     
//PSEUDO   DD DUMMY                                         
//SYSIN    DD *                                             
  DUMP                        /* COMMAND DUMP             */ -   
   DS(INCL(APPCOM.MFA.**))    /* INCLUDE ALL DSN WITH HLQ */ -   
   OUTDD(PSEUDO)             /* OUT DD NAME              */  -   
   DELETE                    /* DELETE ALL THE DATASETS  */     
/*                                                         


Hope this helps...

Cheers

kolusu

#3:  Author: psridhar PostPosted: Tue Apr 12, 2005 8:14 am
    —
Hi Kolusu

Thanks for the reply. But I am getting the following dump with return code 8. It it not possible through REXX commands. Just with curiosity, I am asking.


Code:
PAGE 0001     5695-DF175  DFSMSDSS V1R06.0 DATA SET SERVICES     2005.102 15:10
  DUMP                           /* COMMAND DUMP             */ -
   DS(INCL('UPLSTCS.BPS.**')     /* INCLUDE ALL DSN WITH HLQ */ -
   OUTDD(PSEUDO)                 /* OUT DD NAME              */ -
   DELETE                        /* DELETE ALL THE DATASETS  */
ADR101I (R/I)-RI01 (01), TASKID 001 HAS BEEN ASSIGNED TO COMMAND 'DUMP '
ADR109I (R/I)-RI01 (01), 2005.102 15:10:29 INITIAL SCAN OF USER CONTROL STATEMENTS COMPLETED.
ADR129E (001)-RI01 (01), KEYWORD 'OUTDD ' IS IMPROPER
ADR131E (001)-RI03 (01), ABOVE TEXT BYPASSED UNTIL NEXT COMMAND
ADR017E (001)-CLTSK(01), 2005.102 15:10:29 TASK NOT SCHEDULED DUE TO ERROR. TASK RETURN CODE 0008
ADR012I (SCH)-DSSU (01), 2005.102 15:10:29 DFSMSDSS PROCESSING COMPLETE. HIGHEST RETURN CODE IS 0008 FROM:
                         SYNTAX

#4:  Author: superk PostPosted: Tue Apr 12, 2005 8:19 am
    —
Since this was posted to the TSO and ISPF forum, I worked out this solution using ISPF Library Management services:
Code:

/* REXX */                                                         
"ISPEXEC LMDINIT LISTID(listid) LEVEL(APPCOM.MFA.*)"               
Do Forever                                                         
  "ISPEXEC LMDLIST LISTID(&listid) OPTION(LIST) DATASET(dsn)"     
  If rc <> 0 Then Leave                                           
  Else                                                             
    Do                                                             
      Say "Erasing:'"dsn"'"                                       
      "ISPEXEC LMERASE DATASET('"dsn"')"                           
    End                                                           
End                                                               
"ISPEXEC LMDFREE LISTID(&listid)"                                 

#5:  Author: psridhar PostPosted: Tue Apr 12, 2005 8:24 am
    —
Hi Kolusu,

Thats really great. The REXX code worked fine in my shop. Thank you very much.

I searched for the error code "ADR129E" that my JCL returned but could not able to solve it. Any clue please.........

Regards
Sridhar P

#6:  Author: kolusuLocation: San Jose PostPosted: Tue Apr 12, 2005 8:28 am
    —
psridhar,

You are missing a closing parenthsis on the DS control card.

you have

Code:

DS(INCL('UPLSTCS.BPS.**')     


it should be

Quote:

DS(INCL('UPLSTCS.BPS.**'))


Note the ) in bold at the end

Correct that and re-run your job. It should run fine.

Hope this helps...

Cheers

kolusu

#7:  Author: psridhar PostPosted: Tue Apr 12, 2005 8:39 am
    —
Hi kolusu,

Sorry for the mistake. It works fine.

Thank you very much

Sridhar P

#8: One more REXX code to serve your purpose. Author: vvallaturuLocation: Hyderabad PostPosted: Tue Apr 19, 2005 9:27 pm
    —
Code:

/*  Rexx  */                                                           
Say "This exec deletes the datasets, as required by the user"           
Say "Enter the level of the datasets which are to be deleted"           
Parse Pull level                                                       
X = Outtrap("stem1.")                                                   
Address Tso "Listc lvl("level")"                                       
J=0                                                                     
Do I=1 To Stem1.0                                                       
   J=J+1                                                               
   Parse Var Stem1.I First Rest                                         
   If First="IN-CAT" Then Do                                           
                            J=J-1                                       
                            Iterate                                     
                          End                                           
   Parse Var Rest Rest1 Rest2.J ''                                     
/* Address Tso "Delete" "'"||Rest2||"'" "Scratch" */                   
End                                                                     
Say "Following datasets will be deleted. Press 'y' to confirm and",     
     "any other key to   continue"                                       
 Do I=1 To J                                                             
    Say Rest2.I                                                         
 End                                                                     
 Parse Pull Option                                                       
 K=0                                                                     
 If option='y' Then                                                     
                   Do I=0 To J                                           
                      Address Tso "Delete" "'"||Rest2.I||"'" "Scratch"   
                      K=K+1                                             
                   End                                                   
 If K=3 Then                                                             
 Say 'The datasets are deleted'                                         
 If K<3 & K>0 Then                                                       
 Say 'All the datasets in the above list are not deleted'               
 If K=0 Then                                                             
 Say 'The datsets are not deleted'                                       
 Exit

#9:  Author: mkelley7 PostPosted: Tue Jan 31, 2006 10:06 pm
    —
Sorry, I meant thousands of datasets in the above post.

#10:  Author: semigeezerLocation: Atlantis PostPosted: Tue Jan 31, 2006 10:24 pm
    —
Run hdelete first? Or if these are all dasd data sets run listdsi with norecall and call the appropriate delete routine. (not tested - just posting a thought, really)



MVSFORUMS.com -> TSO and ISPF


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group