ADMIN_DS_RENAME stored procedure
The SYSPROC.ADMIN_DS_RENAME stored procedure renames a physical sequential (PS) data set, a partitioned data set (PDS), a partitioned data set extended (PDSE), or a member of a PDS or PDSE.
Environment
The load module for ADMIN_DS_RENAME, DSNADMDR, must reside in an APF-authorized library. ADMIN_DS_RENAME 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_RENAME stored procedure
- Ownership of the stored procedure
- SYSADM authority
The ADMIN_DS_RENAME caller also needs authorization from an external security system, such as RACF®, in order to rename 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_RENAME--(--data-set-type,-------------> >--data-set-name,--parent-data-set-name,--new-data-set-name,----> >--dump-option,--return-code,--message--)----------------------><
Option descriptions
- data-set-type
- Specifies the type of data set to rename. 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)
This is an input parameter of type INTEGER and cannot be null.
- data-set-name
- Specifies the data set or member to be renamed. 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 renamed.
- 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 renamed.
This is an input parameter of type CHAR(44) and cannot be null.
- parent-data-set-name
- Specifies the name of the PDS or PDSE, if renaming a PDS or PDSE member. Otherwise, a blank
character. 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 renamed.
This is an input parameter of type CHAR(44) and cannot be null.
- new-data-set-name
- Specifies the new data set or member name. Possible values are:
- new data set name
- If data-set-type is 1, 2, or 4, the new-data-set-name contains the new data set name.
- new member name
- If data-set-type is 3, the new-data-set-name contains the new member name.
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 any of the
following errors occurred:
- A call to the IBM® routine IEFDB476 to get messages about an unsuccessful SVC 99 call failed.
- Load IDCAMS program error.
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
- The data set, PDS member, or PDSE member was renamed 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 based on return-code and data-set-type
combinations.
return-code data-set-type Content 0 1, 2, or 4 Contains IDCAMS messages. 0 3 No message is returned. Not 0 not applicable Contains messages describing the error encountered by the stored procedure. The first messages are generated by the stored procedure and messages that are generated by z/OS might follow these first messages. The first messages can also be generated by z/OS. This is an output parameter of type VARCHAR(1331).
Example
The following C language sample shows how to invoke ADMIN_DS_RENAME:
#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_RENAME parameters */
long int dstype; /* Data set type */
char dsname[45]; /* Data set or member name */
char parentds[45]; /* Parent data set (PDS or */
/* PDSE) name or blank */
char newdsname[45]; /* New data set or member name*/
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 rename a library member */
/******************************************************************/
dstype = 3;
strcpy(dsname, "MEMBER01");
strcpy(parentds, "USER.DATASET.PDS");
strcpy(newdsname, "MEMBER0A");
strcpy(dumpopt, "N");
/******************************************************************/
/* Call stored procedure SYSPROC.ADMIN_DS_RENAME */
/******************************************************************/
EXEC SQL CALL SYSPROC.ADMIN_DS_RENAME
(:dstype, :dsname, :parentds, :newdsname,
:dumpopt, :retcd, :errmsg);
return(retcd);
}
Output
This stored procedure returns the following output parameters, which are described in Option descriptions:
- return-code
- message