ADMIN_DS_DELETE stored procedure

The SYSPROC.ADMIN_DS_DELETE stored procedure deletes certain data sets or their members. You can delete a physical sequential (PS) data set, a partitioned data set (PDS), a partitioned data set extended (PDSE), a generation data set (GDS), or a member of a PDS or PDSE.

Environment

Begin general-use programming interface information.

The load module for ADMIN_DS_DELETE, DSNADMDD, must reside in an APF-authorized library. ADMIN_DS_DELETE runs in a WLM-established stored procedures address space, and all libraries in this WLM procedure STEPLIB DD concatenation must be APF-authorized.

Authorization

To execute the CALL statement, the owner of the package or plan that contains the CALL statement must have one or more of the following privileges:

  • The EXECUTE privilege on the ADMIN_DS_DELETE stored procedure
  • Ownership of the stored procedure
  • SYSADM authority

The ADMIN_DS_DELETE caller also needs authorization from an external security system, such as RACF®, in order to delete an z/OS® data set resource.

Syntax

The following syntax diagram shows the SQL CALL statement for invoking this stored procedure:

>>-CALL--SYSPROC.ADMIN_DS_DELETE--(--data-set-type,------------->

>--data-set-name,--parent-data-set-name,--dump-option,---------->

>--return-code,--message--)------------------------------------><

Option descriptions

data-set-type
Specifies the type of data set to delete. Possible values are:
1
Partitioned data set (PDS)
2
Partitioned data set extended (PDSE)
3
Member of a PDS or PDSE
4
Physical sequential data set (PS)
6
Generation data set (GDS)

This is an input parameter of type INTEGER and cannot be null.

data-set-name
Specifies the name of the data set, library member, or GDS absolute generation number to be deleted. Possible values are:
PS, PDS, or PDSE name
If data-set-type is 1, 2, or 4, the data-set-name contains the name of the PS, PDS, or PDSE to be deleted.
PDS or PDSE member name
If data-set-type is 3, the data-set-name contains the name of the PDS or PDSE member to be deleted.
absolute generation number
If data-set-type is 6, the data-set-name contains the absolute generation number of the GDS to be deleted, such as G0001V00.

This is an input parameter of type CHAR(44) and cannot be null.

parent-data-set-name
Specifies the name of the library that contains the member to be deleted, or of the GDG that contains the GDS to be delete. Otherwise blank. Possible values are:
blank
If data-set-type is 1, 2, or 4, the parent-data-set-name is left blank.
PDS or PDSE name
If data-set-type is 3, the parent-data-set-name contains the name of the PDS or PDSE whose member is to be deleted.
GDG name
If data-set-type is 6, the parent-data-set-name contains the name of the GDG that the GDS to be deleted belongs to.

This is an input parameter of type CHAR(44) and cannot be null.

dump-option
Specifies whether to use the DB2® standard dump facility to dump the information necessary for problem diagnosis when a call to the IBM® routine IEFDB476 to get messages about an unsuccessful SVC 99 call failed.

Possible values are:

Y
Generate a dump.
N
Do not generate a dump.

This is an input parameter of type CHAR(1) and cannot be null.

return-code
Provides the return code from the stored procedure. Possible values are:
0
Data set, PDS member, PDSE member, or GDS was deleted successfully.
12
The call did not complete successfully. The message output parameter contains messages describing the error.

This is an output parameter of type INTEGER.

message
Contains messages describing the error encountered by the stored procedure. If no error occurred, then no message is returned.

The first messages in this area are generated by the stored procedure. Messages that are generated by z/OS might follow the first messages.

This is an output parameter of type VARCHAR(1331).

Example

The following C language sample shows how to invoke ADMIN_DS_DELETE:

#include    <stdio.h>
#include    <stdlib.h>
#include		 <string.h>

/******************** DB2 SQL Communication Area ********************/
 EXEC SQL INCLUDE SQLCA;

 int main( int argc, char *argv[] )    /* Argument count and list    */
 {
   /****************** DB2 Host Variables ****************************/
   EXEC SQL BEGIN DECLARE SECTION;

   /* SYSPROC.ADMIN_DS_DELETE parameters                             */
   long int    dstype;                 /* Data set type              */
   char        dsname[45];             /* Data set name ,            */
                                       /* member name, or            */
                                       /* generation # (G0001V00)    */
   char        parentds[45];           /* PDS, PDSE, GDG or blank    */
   char        dumpopt[2];             /* Dump option                */
   long int    retcd;                  /* Return code                */
   char        errmsg[1332];           /* Error message              */
   EXEC SQL END DECLARE SECTION;

   /******************************************************************/
   /* Assign values to input parameters to delete a data set         */
   /******************************************************************/
   dstype = 4;
   strcpy(dsname, "USER.DATASET.PDS");
   strcpy(parentds, " ");
   strcpy(dumpopt, "N");

   /******************************************************************/
   /* Call stored procedure SYSPROC.ADMIN_DS_DELETE                  */
   /******************************************************************/
   EXEC SQL CALL SYSPROC.ADMIN_DS_DELETE
                        (:dstype, :dsname, :parentds, :dumpopt,
                         :retcd,  :errmsg);

   return(retcd);
 }

Output

This stored procedure returns the following output parameters, which are described in Option descriptions:

  • return-code
  • message

End general-use programming interface information.