# Alter and Delete GDG

**ALTERing a GDG Base**

Sometimes after creating a GDG base you might realize you need to change its properties like increasing the limit of generations or switching from NOEMPTY to EMPTY.

Instead of deleting and recreating the base you can simply use the ALTER command to update the existing GDG base definition

You can change attributes like LIMIT, EMPTY/NOEMPTY, and SCRATCH/NOSCRATCH.

You cannot change the GDG name with ALTER command you would need to delete and recreate if you want a new name.

**EXAMPLE**

```
//ALTERGDG JOB (12345),CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//STEP01  EXEC PGM=IDCAMS
//SYSIN   DD  *
    ALTER MYDATA.BACKUP.REPORT LIMIT(10)
/*

```

**Explanation:**

This JCL alters the GDG base MYDATA.BACKUP.REPORT to allow 10 generations instead of its previous limit.

**DELETEing a GDG Base:**

If you no longer need a GDG base (and its associated generations), you can use the DELETE command.

If the generations were created with SCRATCH, they will be completely removed from both catalog and disk.

If the generations were created with NOSCRATCH, they will be uncataloged only and still reside on disk. You will need to know their exact names to access them later.

**EXAMPLE:**

MYDATA.BACKUP.REPORT                           <-----— GDG base\
MYDATA.BACKUP.REPORT.G0001V00      <-----— GDG generation\
MYDATA.BACKUP.REPORT.G0002V00     <-----— GDG generation\
MYDATA.BACKUP.REPORT.G0003V00     <-----— GDG generation

```
//DELETEGDG JOB (12345),CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//STEP01    EXEC PGM=IDCAMS
//SYSPRINT  DD SYSOUT=*
//SYSIN     DD *
     DELETE MYDATA.BACKUP.REPORT GDG FORCE or PURGE
/* 

```

**Explanation:**

DELETE MYDATA.BACKUP. REPORT: Specifies the name of the GDG base that you want to delete.

GDG:Tells the system that the target to be deleted is a Generation Data Group (GDG) base not a regular dataset.

FORCE:Used to delete the GDG base even if it has active generation datasets under it.deletes the base along with all of its generations.

PURGE:Forces the delete, even if the dataset is in use or protected. Useful when normal delete doesn't work


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://open-mainframe-project.gitbook.io/mainframe-open-education-project/chapter-2-mainframe-101-foundational-technology/job-control-language-and-system-display-and-search-facility/gdg/alter-and-delete-gdg.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
