I have many GDG bases, some with many entries and others with no entries.
Currently I use IDCAMS to alter the gdg base limit to (1). It will not allow me to set to a limit of zero. Then I have an IEBGENER step that refers to the last generation with a disp of (OLD,DELETE). I then run a final IDCAMS to delete the gdg base.
This method only works if there is at least one entry in the gdg. If there isn't then the IEBGENER step fails with a JCL error and the second IDCAMS step doesnt run.
I'm looking for a way to delete several gdg bases from MVS, with entries that will not fail if one of the gdg bases doesn't exist ( already deleted ), or doesn't contain any entries.
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
If you use TSO HELP DELETE and review the contents of the Help details for the DELETE command, aren't there options you can use to delete both the base and any existing generations?
I tried "TSO DELETE W.WAVE.P1.CICSCNTL GDG" and got an error
CATALOG ERROR+
** ENTRY ADCB8DI.W.WAVE.P1.CICSCNTL NOT DELETED
LASTCC=8
** VSAM CATALOG RETURN CODE IS 48 - REASON CODE IS IGG0CLFO-28
***
then I tried "tso delete w.wave.p1.cicscntl(*) gdg" and got
INVALID DATA SET NAME, W.WAVE.P1.CICSCNTL(*)
REENTER THIS OPERAND+ -
"tso delete w.wave.p1.l02ac.fomimsgs gdg force" does not work either, but it produces a different error message
ACF04056 ACCESS TO RESOURCE STGADMIN.IGG.DELGDG.FORCE TYPE RFAC BY ADCB8DI NOT
AUTHORIZED
INVALID AUTHORIZATION TO EXECUTE FUNCTION+
** ENTRY ADCB8DI.W.WAVE.P1.L02AC.FOMIMSGS NOT DELETED
LASTCC=8
** VSAM CATALOG RETURN CODE IS 190 - REASON CODE IS IGG0CLFT-12
***
Also how do I call the TSO DELETE command from JCL?
Function -
The DELETE command is used to delete either VSAM objects or NONVSAM
data sets from a VSAM or ICF catalog and to free space occupied by
the objects or data sets. Also the free space of VSAM data components
can be overwritten with zeros. The DELETE command also deletes
GDG bases and VSAM USERCATALOGS.
Operands -
'entryname/password'
- Specifies the name of entry to be deleted.
'entryname'
- Name of entry to be deleted.
'password'
- Password for password-protected cluster, page space,
catalog, alternate index, or path.
Required - 'entryname'
CATALOG('catname/password')
- Specifies the name of catalog containing the entries to be
deleted.
'catname'
- Name of catalog containing the entries to be deleted.
'password'
- Master level password of the catalog.
Required - 'catname'
FILE('dname')
- Specifies the location of the object to be deleted.
'dname' - Name of the DD statement that identifies either the volume
containing the object to be deleted or the data set to be
deleted.
FORCE - The object is to be deleted even though not empty.
This applies only to objects that normally must be
empty to be deleted.
NOFORCE - The object is not to be deleted if it is not empty.
PURGE - The object is to be deleted regardless of expiration date.
NOPURGE - The object is not to be deleted before expiration date.
ERASE - The data component of the cluster is to be overwritten
with binary zeros.
NOERASE - The data component of the cluster is not to be overwritten
with binary zeros.
SCRATCH - The non-VSAM data set being deleted from the catalog is to
be removed from the VTOC of the volume on which it
resides. When SCRATCH is specified for a cluster,
alternate index, page space, or data space, The VTOC
entries for the volumes involved are updated to reflect
the deletion of the object.
NOSCRATCH
- The non-VSAM data set being deleted from the catalog is to
remain in the VTOC of the volume on which it resides
or it has already been scratched from the VTOC.
When NOSCRATCH is specified for a cluster, page space,
alternate index, or data space, the VTOC entries for
the volumes involved are not updated.
RECOVERY - An ICF user catalog or VSAM volume data set is to be
deleted in preparation for recovery.
NORECOVERY
- A user catalog is to be deleted and any objects defined
in the user catalog are to be processed as described
by the FORCE or NOFORCE parameters.
CLUSTER - The entry to be deleted is the entry for a cluster.
SPACE - The entry to be deleted is the entry for a data space.
Required if applicable.
USERCATALOG
- The entry to be deleted is the entry for a user catalog.
Required if applicable.
ALIAS - The entry to be deleted is the entry for an alias.
GENERATIONDATAGROUP
- The entry to be deleted is the entry for a generation data
group.
PAGESPACE
- The entry to be deleted is the entry for a page space.
NONVSAM - The entry to be deleted is the entry for a non-VSAM data
set.
PATH - The entry to be deleted is the entry for a path.
ALTERNATEINDEX -
The entry to be deleted is the entry for an
alternate index.
TRUENAME
- The entry to be deleted is a true name entry in an ICF
catalog.
NVR - The entry to be deleted is a non-VSAM volume record.
required if applicable.
VVR - The entry to be deleted is a VSAM volume record.
Required if applicable.
LIBRARYENTRY
- The entry to be deleted is a library entry.
Required if deleting a library entry.
VOLUMEENTRY
- The entry to be deleted is a volume entry.
Required if deleting a volume entry.
***
So using IDCAMS I can alter the gdg limit from 100 to 1. then I only have one gdg entry to delete. I know how to delete a gdg base with no entries. The only part I am stuck on is how do I tell IDCAMS to delete the last entry in a gdg?
Then I have an IEBGENER step that refers to the last generation with a disp of (OLD,DELETE). This method only works if there is at least one entry in the gdg. If there isn't then the IEBGENER step fails with a JCL error and the second IDCAMS step doesnt run.
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
Quote:
Why don't you use DISP=(MOD,DELETE,DELETE) here?
Not sure it would work if the zero version was unavailable. GDG's can be funny at times, and I think this might be one of those times.
You could do it all in one REXX
- read gdg base name
- reset limit to zero
- listcat gdg base to see if version exists
- if exists - delete version
- delete gdg base
While not as pretty as I'd like I guess the best way to do it is do the following:
job to reset all the limits to 1 - cant set the limit to zero
many ( 30+ ) single step IEBGENER jobs with DISP=(MOD,DELETE,DELETE)
a final job to delete all the gdg bases.
messy but since I can put all the jcl in one pds member I will only have one submit to run. if the individual iebgener jobs fail it will not stop the remaining jobs from running.
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
To be honest, you have a real task which would lend itself very much to a REXX solution.
If you can get half a day to try and code some very very basic REXX, reading and writing files, this would have been / could still be a great learning opportunity for you, and also performing a real task at the same time.
Let's face it, if you need to delete things, then making an error or six during testing isn't really a problem.
Generated dataset can be used in IDCAMS step to delete GDGBASEs.
Please note there should be no active generations so you can modify this setup to first generate IDCAMS delete Statement to delete GDG generations and that would be something like this to use in STP0200 SYSIN:
Code:
SORT FIELDS=COPY
INCLUDE COND=(6,07,CH,EQ,C'NONVSAM')
OUTREC FIELDS=(C' DELETE ',12:21,45,24X),CONVERT
Thanks for the sample code. I was able to create a job that deletes all the datasets I need, including the gdg bases. The only thing I noticed with your sample is I had to change