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

Migrated dataset deletion


IBM Mainframe Forums -> JCL & VSAM
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
trilokdewangan

New User


Joined: 19 Jun 2008
Posts: 39
Location: USA

PostPosted: Mon Aug 18, 2008 3:54 pm
Reply with quote

Hello,

I have some datasets like given below...and all are migrated in tape. I want to delete those dataset and count of same are more than 25,000.

Dataset are like

XXX.YYY.ZZZ.ABC
XXX.YYY.ZZZ.ASD
XXX.YYY.ZZZ.AFD
...
...
...
and so on. In summary I want to delete all detaset starts with XXX.YYY.ZZZ.*. And all are migrated in tape.

Thanks,
Trilok
Back to top
View user's profile Send private message
krithikaj

New User


Joined: 10 Aug 2008
Posts: 45
Location: India

PostPosted: Mon Aug 18, 2008 3:57 pm
Reply with quote

Try using IDCAMS and delete.

Regards,
KJ
Back to top
View user's profile Send private message
krithikaj

New User


Joined: 10 Aug 2008
Posts: 45
Location: India

PostPosted: Mon Aug 18, 2008 4:07 pm
Reply with quote

Use this JCL and check out if it helps out. I could execute it successfully.

//STEP010 EXEC PGM=IEFBR14
//DD1 DD DSN=<DATASET>,
// DISP=(MOD,DELETE,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(30,10),RLSE)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSABOUT DD SYSOUT=*

Regards,
KJ
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Aug 18, 2008 4:22 pm
Reply with quote

krithikaj wrote:
Use this JCL and check out if it helps out. I could execute it successfully.

//STEP010 EXEC PGM=IEFBR14
//DD1 DD DSN=<DATASET>,
// DISP=(MOD,DELETE,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(30,10),RLSE)


Using IEFBR14 will cause the dataset to be recalled from tape before deleting it. Why waste the time and resource to physically recall the dataset when all you want to do is to delete it.

The IDCAMS solution is OK, but is limited to the use of wildcards.

CSI is a much more flexible way of using REXX, and I might have one somewhere. Will post it if I already have it.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Aug 18, 2008 4:39 pm
Reply with quote

The JCL - uses PARM values to select (a) What you want to do and (b) on which types of datasets.

For your first run use PARM='CSIUTIL SCAN MIGR' to get a listing of datasets that would have been deleted.

For the real run use PARM='CSIUTIL RUN MIGR' to delete the migrated datasets.

You can probably see what else it can do by reading the comments in the JCL.

EXCLUDE DD will exclude datasets from procesing, but I can not remember if it can use a prefix follwowed by * i.e. ABC.NODEL.*, but you definitely use the fully qualified DSN. Should be easy enough for you to work that one out.
Code:

//STEP0020 EXEC PGM=IKJEFT01,DYNAMNBR=256,                   
//           PARM='CSIUTIL SCAN DASD TAPE MIGR'               
//*   PARM VALUES - SCAN    - LIST ONLY                       
//*               - RUN     - PROCESS REQUESTS - DELETE OR HSM
//*               - DASD    - LIST/DELETE DASD DATASETS           
//*               - MIGR    - LIST/DELETE MIGRATED DATASETS       
//*               - TAPE    - LIST/DELETE TAPE DATASETS           
//*               - RCALL   - LIST/RECALL SELECTED DATASETS       
//*               - ARCH    - LIST/MIGRATE SELECTED DATASETS TO ML1
//*               - ARCH2   - LIST/MIGRATE SELECTED DATASETS TO ML2
//SYSEXEC  DD DSN=MY.REXX,DISP=SHR                           
//SYSOUT   DD SYSOUT=*                                       
//SYSTSPRT DD SYSOUT=*                                       
//SYSTSIN  DD DUMMY                                           
//DATASETS DD *                                               
HLQ.**
/*                                                           
//EXCLUDE  DD *                                               
HLQ.DATASET.ONE
HLQ.DATASET.NINE
/*                                                           


The REXX code - called CSIUTIL in MY.REXX
Code:

/* REXX ** INVOKE CSI VIA BATCH REXX PROCESS
        ** LIST OR DELETE ALL ENTRIES FOR GIVEN DSN PATTERNS
           ALSO TO FILTER BY DASD TAPE OR MIGR                       */
ARG RUNTYP UNIT
IF RUNTYP <> "RUN" THEN RUNTYP = "SCAN"
IF POS('MIGR',UNIT) > 0 & POS('RCALL',UNIT) > 0 THEN DO
   SAY " "
   SAY "RECALL AND HDELETE BOTH SPECIFIED FOR MIGRATED DATASETS"
   SAY "EXIT REURN CODE 16 *** EXIT RETURN CODE 16 "
   EXIT(16)
END
 "EXECIO * DISKR EXCLUDE ( STEM EXC. FINIS"
 DO A = 1 TO EXC.0
   IF POS('*',EXC.A) > 0 THEN DO
     EXCLDIT.A = STRIP(SUBSTR(EXC.A,1,POS('*',EXC.A)-1))
     GEN.A = "Y"
   END
   ELSE DO
     EXCLDIT.A = STRIP(EXC.A)
     GEN.A = "N"
   END
 END
 "EXECIO * DISKR DATASETS ( STEM CAT. FINIS"
 DO KCNT = 1 TO CAT.0               
 KEY = SUBSTR(CAT.KCNT,1,44)     
MODRSNRC = SUBSTR(' ',1,4)         
CSIFILTK = SUBSTR(KEY,1,44)   
CSICATNM = SUBSTR(' ',1,44)   
CSIRESNM = SUBSTR(' ',1,44)   
CSIDTYPS = SUBSTR(' ',1,16)
CSICLDI  = SUBSTR('Y',1,1) 
CSIRESUM = SUBSTR(' ',1,1) 
CSIS1CAT = SUBSTR(' ',1,1)
CSIRESRV = SUBSTR(' ',1,1) 
CSINUMEN = '0002'X         
CSIFLD1  = 'VOLSER  '   
CSIFLD2  = 'DEVTYP  '   
CSIOPTS  = CSICLDI !! CSIRESUM !! CSIS1CAT !! CSIRESRV
CSIFIELD = CSIFILTK !! CSICATNM !! CSIRESNM !! CSIDTYPS !! CSIOPTS
CSIFIELD = CSIFIELD !! CSINUMEN !! CSIFLD1 !! CSIFLD2
WORKLEN = 4096
DWORK = '00001000'X !! COPIES('00'X,WORKLEN-4)
RESUME = 'Y'
CATNAMET = SUBSTR(' ',1,44)
DNAMET = SUBSTR(' ',1,44)
DO WHILE RESUME = 'Y'
 ADDRESS LINKPGM 'IGGCSI00  MODRSNRC  CSIFIELD  DWORK'
 RESUME = SUBSTR(CSIFIELD,150,1)   
 USEDLEN = C2D(SUBSTR(DWORK,9,4))   
 POS1=15                           
 DO WHILE POS1 < USEDLEN           
   IF SUBSTR(DWORK,POS1+1,1) = '0' 
    THEN DO
         CATNAME=SUBSTR(DWORK,POS1+2,44)
         IF CATNAME <> CATNAMET THEN
          DO                       
           CATNAMET = CATNAME
          END
         POS1 = POS1 + 50
         END
   DNAME = SUBSTR(DWORK,POS1+2,44) 
   PRO = "Y"
   DO ZZ = 1 TO EXC.0
     EXCLDLN = LENGTH(EXCLDIT.ZZ)
     IF GEN.ZZ = "N" THEN DO
       IF STRIP(DNAME) = STRIP(EXCLDIT.ZZ) THEN PRO = "N"
     END
     ELSE DO
       IF STRIP(LEFT(DNAME,EXCLDLN)) = STRIP(EXCLDIT.ZZ) THEN PRO = "N"
     END
   END
   IF SUBSTR(DWORK,POS1+1,1) = 'C' THEN DTYPE = 'CLUSTER '
    ELSE
      IF SUBSTR(DWORK,POS1+1,1) = 'D' THEN DTYPE = 'DATA    '
     ELSE
      IF SUBSTR(DWORK,POS1+1,1) = 'I' THEN DTYPE = 'INDEX   '
     ELSE
      IF SUBSTR(DWORK,POS1+1,1) = 'A' THEN DTYPE = 'NONVSAM '
     ELSE
      IF SUBSTR(DWORK,POS1+1,1) = 'H' THEN DTYPE = 'GDS     '
     ELSE
      IF SUBSTR(DWORK,POS1+1,1) = 'B' THEN DTYPE = 'GDG     '
     ELSE
      IF SUBSTR(DWORK,POS1+1,1) = 'R' THEN DTYPE = 'PATH    '
     ELSE
      IF SUBSTR(DWORK,POS1+1,1) = 'G' THEN DTYPE = 'AIX     '
     ELSE
      IF SUBSTR(DWORK,POS1+1,1) = 'X' THEN DTYPE = 'ALIAS   '
     ELSE
      IF SUBSTR(DWORK,POS1+1,1) = 'U' THEN DTYPE = 'UCAT    '
     ELSE
      DTYPE = '        '
    POS1 = POS1 + 46
    NUMVOL = C2D(SUBSTR(DWORK,POS1+4,2))/6
    POS2 = POS1+8                   
    DO I=1 TO NUMVOL               
      VOLSER.I = SUBSTR(' ',1,6)
    END
    DO I = 1 TO NUMVOL             
      VOLSER.I = SUBSTR(DWORK,POS2,6)
      POS2 = POS2 + 6
    END
    IF NUMVOL > 1 THEN MVL = '+'
      ELSE
        MVL = ' '
    DEVTY1 = SUBSTR(DWORK,POS2,4)
    DEVTY2 = C2X(DEVTY1)
    IF SUBSTR(DEVTY2,5,2) = '20' THEN DELDEV = 'DASD'
      ELSE
        IF SUBSTR(DEVTY2,5,2) = '80' THEN DELDEV = 'TAPE'
          ELSE
            DELDEV = 'XXXX'
    IF DELDEV = 'DASD' THEN MIGLEV = ' ML1'
      ELSE
        MIGLEV = ' ML2'
    IF DNAMET <> DNAME THEN   
    DO                           
     DNAMET=DNAME
     DNAM2 = STRIP(DNAME)
     IF DTYPE = 'GDG' ! DELDEV = 'XXXX' THEN PRO = 'N'
     IF PRO = "Y" THEN DO
       IF VOLSER.1 = 'MIGRAT' THEN
         DO
          IF POS('MIGR',UNIT) > 0 ! POS('RCALL',UNIT) > 0 THEN DO
            IF RUNTYP = "RUN" THEN
            DO
              IF POS('MIGR',UNIT) > 0 THEN DO
                SAY "          HDEL FOR "DNAM2
                " HDELETE '"DNAM2"'"
              END
              ELSE IF POS('RCALL',UNIT) > 0 THEN DO
                SAY "          HRECALL FOR "DNAM2
                " HRECALL '"DNAM2"'"
              END
            END
            ELSE
              SAY COPIES(' ',8) DTYPE DNAME VOLSER.1 MVL MIGLEV
          END
         END
       ELSE IF VOLSER.1 <> 'MIGRAT' THEN
         DO
          IF DTYPE = 'CLUSTER' & POS('DASD',UNIT) > 0 THEN DO
             IF RUNTYP = "RUN" THEN DO
               " DELETE '"DNAM2"'"
             END
             ELSE
               SAY COPIES(' ',8) DTYPE DNAME VOLSER.1 MVL DELDEV
          END
          ELSE DO
          IF DELDEV = 'TAPE' & POS('TAPE',UNIT) > 0
           THEN
             DO
               IF RUNTYP = "RUN" THEN
                 DO
                    " DELETE '"DNAM2"' NOSCRATCH "
                 END
               ELSE
                 SAY COPIES(' ',8) DTYPE DNAME VOLSER.1 MVL DELDEV
            END
          IF DELDEV = 'DASD' & POS('DASD',UNIT) > 0 ,
           & VOLSER.1 <> 'MIGRAT' THEN
            DO
               IF RUNTYP = "RUN" THEN
                 DO
                    " DELETE '"DNAM2"'"
                 END
                 ELSE
                   SAY COPIES(' ',8) DTYPE DNAME VOLSER.1 MVL DELDEV
            END
          IF DELDEV = 'DASD' & POS('ARCH',UNIT) > 0 ,
           & VOLSER.1 <> 'MIGRAT' THEN
            DO
               IF SUBSTR(UNIT,POS('ARCH',UNIT)+4,1) = '2'
                 THEN ML = "ML2"
                 ELSE ML = ""
               IF RUNTYP = "RUN" THEN
                 DO
                    SAY COPIES(' ',8) DTYPE DNAME VOLSER.1 MVL DELDEV
                    " HMIG '"DNAM2"'" ML
                 END
                 ELSE
                   SAY COPIES(' ',8) DTYPE DNAME VOLSER.1 MVL DELDEV
            END
         END
       END
    END
    POS1 = POS1 + C2D(SUBSTR(DWORK,POS1,2))
  END
END
END
END
Back to top
View user's profile Send private message
saroragu

New User


Joined: 12 Nov 2008
Posts: 22
Location: india

PostPosted: Mon Feb 09, 2009 11:38 am
Reply with quote

I have copied the code that you had send. I got an error as
IRX0408E Exec member name must not be specified when exec load DD refers to a sequential data set.
will you please tell me how to give the rexx program?.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Feb 09, 2009 3:25 pm
Reply with quote

Put the code into a PDS member
Back to top
View user's profile Send private message
saroragu

New User


Joined: 12 Nov 2008
Posts: 22
Location: india

PostPosted: Mon Feb 09, 2009 3:35 pm
Reply with quote

I put that in my working PDS its giving the same error.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Feb 09, 2009 3:43 pm
Reply with quote

Post the JCL and the error message(s)
Back to top
View user's profile Send private message
saroragu

New User


Joined: 12 Nov 2008
Posts: 22
Location: india

PostPosted: Mon Feb 09, 2009 3:56 pm
Reply with quote

Code:
//H2567AMB JOB ('DSCACCIA'),MSGCLASS=O,TIME=(,5),NOTIFY=&SYSUID       
//STEP0020 EXEC PGM=IKJEFT01,DYNAMNBR=256,                             
//           PARM='CSIUTIL SCAN DASD TAPE MIGR'                       
//*   PARM VALUES - SCAN    - LIST ONLY                               
//*               - RUN     - PROCESS REQUESTS - DELETE OR HSM         
//*               - DASD    - LIST/DELETE DASD DATASETS               
//*               - MIGR    - LIST/DELETE MIGRATED DATASETS           
//*               - TAPE    - LIST/DELETE TAPE DATASETS               
//*               - RCALL   - LIST/RECALL SELECTED DATASETS           
//*               - ARCH    - LIST/MIGRATE SELECTED DATASETS TO ML1   
//*               - ARCH2   - LIST/MIGRATE SELECTED DATASETS TO ML2   
//SYSEXEC  DD DSN=H2567AM.TEST.PROCS(REXX),DISP=SHR                   
//SYSOUT   DD SYSOUT=*                                                 
//SYSTSPRT DD SYSOUT=*                                                 
//SYSTSIN  DD DUMMY                                                   
//DATASETS DD *                                                       
H2567AM.**                                                             
/*                                                                     
//EXCLUDE  DD *   
H2567AM.BACKUP     
H2567AM.TEST.BACKUP
/* 


Code:
error message
IRX0408E Exec member name must not be specified when exec load DD refers to a sequential data set.
 READY
 END   


This is the error message I got in SYSTSPRT
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Feb 09, 2009 5:01 pm
Reply with quote

The REXX code needs to be in a member CSIUTIL (or the name specified in PARM statement) and do not code a member name in the SYSEXEC statement
Back to top
View user's profile Send private message
saroragu

New User


Joined: 12 Nov 2008
Posts: 22
Location: india

PostPosted: Mon Feb 09, 2009 5:20 pm
Reply with quote

Thanks a lot.Im not aware of REXX how to learn it from the basic.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon Feb 09, 2009 5:49 pm
Reply with quote

Hi,

Please check these links from "CLIST & REXX" part of the Forum, they are nothing but "sticky" from there..

ibmmainframes.com/viewtopic.php?t=21147
ibmmainframes.com/viewtopic.php?t=20367

Please learn to search on these forums, you'll get many more links than expected..
Back to top
View user's profile Send private message
saroragu

New User


Joined: 12 Nov 2008
Posts: 22
Location: india

PostPosted: Mon Feb 09, 2009 5:55 pm
Reply with quote

Thanks for your sugesstions.I once again thank you for helping me in this.....
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2594
Location: Silicon Valley

PostPosted: Fri Feb 10, 2012 3:16 am
Reply with quote

It is not clear if the solution was mentioned.

But this
Code:
//SYSEXEC  DD DSN=H2567AM.TEST.PROCS(REXX),DISP=SHR


will result in a the situation mentioned in this message:
Code:
IRX0408E Exec member name must not be specified when exec load DD refers to a sequential data set.


The SYSEXEC DD statement should refer to the PDS name, and not to a member of a PDS.

A PDS member appears to applications as a sequential dataset. Whereas, in this situation, you want only to provide the PDS that contains the member.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Fri Feb 10, 2012 3:29 am
Reply with quote

tu quoque Pedro icon_wink.gif


The topic has been resurrected after
Code:
...          3 year(s) - (months difference / 12 )
...          3 year(s) - (difference )
...         36 months
...       1095 days
...      26289 hours
...    1577361 minutes
...   94641660 seconds
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2594
Location: Silicon Valley

PostPosted: Fri Feb 10, 2012 4:20 am
Reply with quote

Sorry.

It somehow showed up in the list of recently appended threads. (or something like that). I normally do not look at old stuff.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Fri Feb 10, 2012 10:15 am
Reply with quote

Sorry for what ? I was just pulling Your leg icon_biggrin.gif
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Feb 10, 2012 7:24 pm
Reply with quote

I am not sure if this has been mentioned elsewhere on this board (I couldn't find it in a Search), but IEFBR14 no longer has to HRECALL a migrated data set before deleting it.

Apparently, the new behaviour is in z/OS not IEFBR14 itself; the system intercepts HRECALL requests resulting from IEFBR14 and, if the DISP is DELETE,DELETE, it performs an HDELETE instead.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 10, 2012 7:44 pm
Reply with quote

Is that an explicit DELETE,DELETE or does it work with (OLD,DELETE)?

That would make IEFBR14 something "special", like a part of the OS rather than a do-nothing program. Kind of hard to describe. Or have they changed IEFBR14 itself to do that? Interesting.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Feb 10, 2012 11:46 pm
Reply with quote

Sorry, I meant (MOD,DELETE,DELETE). (OLD,DELETE,DELETE) should probably work too. I tend to use the former as it works even if the DSN does not exist.

I understand that they didn't change IEFBR14. It is now treated by the OS as a "special" program. This caused some controversy on IBM-MAIN because it introduces an inconsistency. On the other hand, it is a very useful inconsistency.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon Feb 13, 2012 5:01 pm
Reply with quote

The enhancement in z/OS 1.11 is that Batch Allocation/Unallocation processing is checking to see if the program name is exactly 'IEFBR14', and if so, for migrated data sets whose DISP is DELETE, it simply HDELETEs them without HRECALLing them. DISP=(*,DELETE) is applicable.
Back to top
View user's profile Send private message
steven.daniels

New User


Joined: 22 Jan 2021
Posts: 1
Location: United States

PostPosted: Fri Jan 22, 2021 9:41 pm
Reply with quote

I ran with PARM='CSIUTIL SCAN MIGR' to get a listing of datasets that would have been deleted and got no output.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Jan 22, 2021 10:42 pm
Reply with quote

Welcome!
Please avoid tailgating any old posts and start your own new one if you have a specific questions, you can reference this post in your new post if you need to.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts batch SFTP job using AOPBATCH unable ... All Other Mainframe Topics 7
No new posts Reading Empty Dataset DFSORT/ICETOOL 5
No new posts Mainframe Dataset Binary or ASCII Mainframe Interview Questions 4
No new posts SPOOL to Mainframe dataset in batch mode JCL & VSAM 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top