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.
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.
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
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.
/* 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
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?.
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
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.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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.
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
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.
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
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.
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.