Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to delete GDG base from MVS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
mpegg

New User


Joined: 27 Feb 2007
Posts: 5
Location: toronto

PostPosted: Mon May 07, 2007 10:28 pm    Post subject: How to delete GDG base from MVS
Reply with quote

Hi,

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

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Mon May 07, 2007 10:39 pm    Post subject: Re: How to delete GDG base and all entries of GDG
Reply with quote

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?
Back to top
View user's profile Send private message
mpegg

New User


Joined: 27 Feb 2007
Posts: 5
Location: toronto

PostPosted: Mon May 07, 2007 11:01 pm    Post subject:
Reply with quote

TSO HELP DELETE output is shown at the bottom....

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.


Syntax -
DELETE ('entryname/password' ...)
CATALOG('catname/password')
FILE('dname')
PURGE | NOPURGE
ERASE | NOERASE
SCRATCH | NOSCRATCH
FORCE | NOFORCE
RECOVERY | NORECOVERY
CLUSTER | SPACE | USERCATALOG |
ALIAS | GENERATIONDATAGROUP | PAGESPACE |
NONVSAM | PATH | ALTERNATEINDEX | TRUENAME |
NVR | VVR | VOLUMEENTRY | LIBRARYENTRY

Required - 'entryname'
SPACE (if applicable)
USERCATALOG (if applicable)

Defaults - NOPURGE
SCRATCH
NOFORCE
NORECOVERY

Abbreviations -
Note - In addition to normal TSO short forms, these are accepted.

DELETE DEL
PURGE PRG
FORCE FRC
NOFORCE NFRC
NOPURGE NPRG
NOERASE NERAS
NOSCRATCH NSCR
RECOVERY RCVRY
NORECOVERY NRCVRY
SPACE SPC
USERCATALOG UCAT
GENERATIONDATAGROUP GDG
PAGESPACE PGSPC
NONVSAM NVSAM
ALTERNATEINDEX AIX
TRUENAME TNAME
LIBRARYENTRY LIBENTRY LIBENT
VOLUMEENTRY VOLENTRY VOLENT


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

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue May 08, 2007 1:00 pm    Post subject:
Reply with quote

You need to delete all of the entries in the base before deleting the base as you are unauthorised to use the FORCE parameter.

Quote:
Also how do I call the TSO DELETE command from JCL?

Just as you are now, by using IDCAMS
Back to top
View user's profile Send private message
mpegg

New User


Joined: 27 Feb 2007
Posts: 5
Location: toronto

PostPosted: Tue May 08, 2007 4:48 pm    Post subject:
Reply with quote

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?

I've tried
delete myfile(0)
delete myfile.g*
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Tue May 08, 2007 4:59 pm    Post subject:
Reply with quote

Quote:
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.

Why don't you use DISP=(MOD,DELETE,DELETE) here?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue May 08, 2007 5:29 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue May 08, 2007 5:39 pm    Post subject:
Reply with quote

agkshirsagar

Nice thought, but unfortunately it did not work .........

DD01 DD DSN=gdg base name (0),DISP=(MOD,DELETE,DELETE)

STEP DD01 - DISP FIELD INCOMPATIBLE WITH DSNAME
Back to top
View user's profile Send private message
mpegg

New User


Joined: 27 Feb 2007
Posts: 5
Location: toronto

PostPosted: Tue May 08, 2007 7:53 pm    Post subject:
Reply with quote

I'm not familiar with REXX at this point.

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue May 08, 2007 7:59 pm    Post subject:
Reply with quote

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

Active User


Joined: 14 Jun 2005
Posts: 186
Location: USA

PostPosted: Tue May 08, 2007 8:24 pm    Post subject:
Reply with quote

To delete GDG base IDCAMS can be used:

Code:

//STP0100 EXEC PGM=IDCAMS               
//SYSOUT   DD  SYSOUT=*                 
//SYSTSPRT DD  SYSOUT=*                 
//SYSPRINT DD  SYSOUT=*                 
//SYSIN    DD *                         
 DELETE     xxx.xxxxxxx.TESTGDG PURGE   
/*                                     
//*                                     


If you want to generate DELETE statement you can use again IDCAMS to do that:

Code:

//STP0100 EXEC PGM=IDCAMS                                     
//SYSPRINT DD DSN=xxx.xxxxxxx.LISTCAT,                         
//             DISP=(,CATLG,DELETE),                           
//             UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE),           
//             DCB=MODEL.DSCB1                                 
//SYSIN DD *                                                   
 LISTCAT LEVEL(xxxx.jobxxxx.xxx) -                             
 GENERATIONDATAGROUP -                                         
 NAME                                                         
/*                                                             
//SYSOUT   DD  SYSOUT=*                                       
//*                                                           
//*                                                           
//STP0200 EXEC PGM=SORT   
//SORTIN   DD DSN=xxx.xxxxxxx.LISTCAT,DISP=SHR                 
//SORTOUT  DD DSN=xxx.xxxxxxx.LISTCAT.DELETE,                   
//             DISP=(,CATLG,DELETE),                           
//             UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE),             
//             DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)               
//SYSIN DD *                                                   
 SORT FIELDS=COPY                                               
 INCLUDE COND=(6,08,CH,EQ,C'GDG BASE')                         
 OUTREC FIELDS=(C' DELETE ',12:21,45,70:C'PURGE',6X),CONVERT   
/*                                                             
//SYSOUT   DD  SYSOUT=*                                         
//SYSTSPRT DD  SYSOUT=*                                         
//SYSPRINT DD  SYSOUT=*                                         
//SYSABOUT DD  SYSOUT=*                                         
//SYSDUMP  DD  SYSOUT=*                                         
//SYSUDUMP DD  SYSOUT=*                                         
//ABENDAID DD SYSOUT=*         
                                                                     


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   
Back to top
View user's profile Send private message
mpegg

New User


Joined: 27 Feb 2007
Posts: 5
Location: toronto

PostPosted: Tue May 08, 2007 11:17 pm    Post subject:
Reply with quote

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
Code:

 OUTREC FIELDS=(C' DELETE ',12:21,45,70:C'PURGE',6X),CONVERT

to
Code:

 OUTREC FIELDS=(C' DELETE ',12:21,45,65:C'PURGE',6X),CONVERT

because IDCAMS complained that keyword 'PUR' is improper. Below is my final working code

Code:

****** ***************************** Top of Data ******************************
000001 //ADCB8DI1 JOB (000000,,3993,0805,,9999),'DEL WAVES DATA',             
000002 //    MSGLEVEL=(1,1),NOTIFY=&SYSUID,MSGCLASS=Q,CLASS=N                 
000003 //*                                                                     
000004 //*********************************************************************
000005 //STEP010 EXEC PGM=IDCAMS                                               
000006 //SYSPRINT DD  DSN=&&LIST,DISP=(,PASS),SPACE=(TRK,(100,50),RLSE),       
000007 //             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)                       
000008 //SYSIN DD *                                                           
000009  LISTCAT LEVEL(ADCB8DI.W.WAVE.P4) NAME                                 
000010 /*                                                                     
000011 //*********************************************************************
000012 //STEP020 EXEC PGM=SORT                                                 
000013 //SYSOUT   DD  SYSOUT=*                                                 
000014 //SYSPRINT DD  SYSOUT=*                                                 
000015 //SORTIN   DD  DSN=&&LIST,DISP=(OLD,PASS)                               
000016 //SORTOUT  DD  DSN=&&FILELIST,DISP=(,PASS),                             
000017 //             SPACE=(TRK,(100,50),RLSE),DCB=*.SORTIN                   
000018 //SYSIN DD *                                                           
000019  SORT FIELDS=COPY                                                       
000020  INCLUDE COND=(6,07,CH,EQ,C'NONVSAM')                                   
000021  OUTREC FIELDS=(C' DELETE ',12:21,45,24X),CONVERT                       
000022 /*                                                                     
000023 //*********************************************************************
000024 //STEP030 EXEC PGM=SORT                                                 
000025 //SYSOUT   DD  SYSOUT=*                                                 
000026 //SYSPRINT DD  SYSOUT=*                                                 
000027 //SORTIN   DD DSN=&&LIST,DISP=(OLD,PASS)                               
 000028 //SORTOUT  DD DSN=&&GDGLIST,DISP=(,PASS),                               
 000029 //             SPACE=(TRK,(100,50),RLSE),DCB=*.SORTIN                   
 000030 //SYSIN DD *                                                           
 000031  SORT FIELDS=COPY                                                       
 000032  INCLUDE COND=(6,08,CH,EQ,C'GDG BASE')                                 
 000033  OUTREC FIELDS=(C' DELETE ',12:21,45,65:C'PURGE',6X),CONVERT           
 000034 /*                                                                     
 000035 //*********************************************************************
 000036 //STEP040 EXEC PGM=IDCAMS                                               
 000037 //SYSPRINT DD SYSOUT=*                                                 
 000038 //SYSIN    DD DSN=&&FILELIST,DISP=(OLD,PASS)                           
 000039 //*                                                                     
 000040 //*********************************************************************
 000041 //STEP045 EXEC PGM=IDCAMS                                               
 000042 //SYSPRINT DD SYSOUT=*                                                 
 000043 //SYSIN    DD DSN=&&GDGLIST,DISP=(OLD,PASS)                             
 000044 //*                                                                     
 ****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 08, 2007 11:50 pm    Post subject:
Reply with quote

Thank you for posting your solution icon_smile.gif

Now, others may benefit from what you've built.
Back to top
View user's profile Send private message
ashishsr123

New User


Joined: 06 May 2008
Posts: 33
Location: Chennai

PostPosted: Sat Oct 11, 2008 2:18 pm    Post subject: Reply to: How to delete GDG base and all entries of GDG
Reply with quote

also go thru this post to understand better

http://ibmmainframes.com/about10825.html
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 205
Location: Bangalore

PostPosted: Sat Oct 11, 2008 2:40 pm    Post subject: Reply to: How to delete GDG base and all entries of GDG
Reply with quote

Hi MFRASHEED,

//SYSIN DD *
Quote:
LISTCAT LEVEL(xxxx.jobxxxx.xxx) -
GENERATIONDATAGROUP -
NAME
/*



What does not the above control statement do?

Thanks,
Ajay
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts Delete record or Reset RC code using ... mpawan Compuware & Other Tools 4 Tue Jul 26, 2016 3:52 pm
No new posts Delete VSAM File Records amitc23 CICS 6 Sun Apr 10, 2016 10:10 am
No new posts DB2 Stored Procedure - Dynamic SQL - ... GuyC DB2 2 Wed Feb 17, 2016 5:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us