PDS Procedure: z/OS

Lists, deletes, or renames members of a partitioned data set.
z/OS specifics: All

Syntax

PROC PDS DDNAME=file-specification <options > ;
DELETE member-1 <. . . member-n > ;
CHANGE old-name-1 =new-name-1 < . . . old-name-n =new-name-n > ;
EXCHANGE name-1=other-name-1 < . . . name-n =other-name-n > ;

Details

Overview PROC PDS

Partitioned data sets (PDS) are libraries that contain files called members. There are two types of partitioned data sets. One can contain source code, macros, cataloged procedures, and other data. The other, called a load library, can contain only load modules.
PROC PDS operates on the directory of a partitioned data set to list, delete, and rename members and aliases. (Partitioned data sets are not the same as SAS libraries.) When members are deleted or renamed, PROC PDS updates the directory of the partitioned data set. Also, unless NOLIST is specified, PROC PDS writes an updated listing of the PDS member names to the SAS log.
PROC PDS operates with full capabilities on both extended partitioned data sets (PDSEs) and standard partitioned data sets (PDSs).

PROC PDS Statement

PROC PDS DDNAME=file-specification <options> ;
DDNAME=file-specification
specifies the physical filename (enclosed in quotation marks) or the fileref that is associated with the partitioned data set that you want to process. A fileref must have been previously assigned with a FILENAME statement, FILENAME function, a JCL DD statement, or a TSO ALLOCATE command. The DDNAME= argument is required.
The following options can appear in the PROC PDS statement:
NOLIST
suppresses the listing of the member names and aliases in the directory of the partitioned data set.
KILL
deletes all the members of the partitioned data set that is specified by DDNAME=.
REFRESH | NOREFRESH
specifies whether to update the directory information of the file that is being processed after each operation. The default, REFRESH, updates the directory information after each operation. Unless the operations that are being performed by PROC PDS are dependent on each other, specify NOREFRESH for better performance.
STRICT
causes error messages to be generated and sets the return code to 8 if no members match the selection criteria. The default behavior is for note messages to be generated and for the return code to be set to 0 if no members match the selection criteria.

DELETE Statement

DELETE member-1 <. . . member-n > ;
If you want to delete a member or members from the PDS, specify the member names in a DELETE statement.
When a specification in the DELETE statement is followed by a colon (:), all members whose names begin with the characters preceding the colon are deleted. For example, when the following statement is executed, PROC PDS deletes all members whose names begin with the characters PRGM:
delete prgm:;

CHANGE Statement

CHANGE old-name-1 =new-name-1 < . . . old-name-n =new-name-n > ;
If you want to rename a member or members of the PDS, use the CHANGE statement. Specify the old name on the left side of the equal sign, and specify the new name on the right. For example, the following statements change the name of member TESTPGM to PRODPGM:
filename loadlib 'my.pgm.lib ';
proc pds ddname=loadlib;
   change testpgm=prodpgm;
run;
If multiple members have names that begin with the same sequence of characters and you want to change all of the names so that they begin with a different sequence, use a colon (:) after old-name and new-name. Here is an example:
change exam:=test:;
All of the members whose names began with the characters EXAM will subsequently have names beginning with the characters TEST.
Note: If changing the name of a member would duplicate the name of an existing member, then the member is not renamed and a note is written to the SAS log.
It is not necessary for the lengths of the character sequences that precede the colon to match. For example, the following statement is valid:
change am:=morn:;
However, if a new name is too long, then a note is written to the SAS log and no change is made.

EXCHANGE Statement

EXCHANGE name-1=other-name-1 < . . . name-n =other-name-n > ;
Use the EXCHANGE statement to switch the names of members of the partitioned data set. For example, after the following statements are executed, the member originally called A is named Z, and the member originally called Z is named A.
proc pds ddname='my.pgm.lib';
   exchange a=z;
run;
If multiple members have names that begin with the same sequence of characters and you want to exchange that sequence with the sequence from another group of data sets, use a colon (:) after name and other-name. For example, after the following statement is executed, all data sets whose names began with ABC will begin with DEFG. In addition, all of the data sets whose names began with DEFG will begin with ABC.
exchange abc:=defg:;
It is not necessary for the lengths of the sequences of characters that precede the colons to match. However, if a new name is too long, then a note is written to the SAS log and no change is made.

Usage Note

Unlike other SAS procedures that deal with partitioned data sets (for example, PROC PDSCOPY and PROC SOURCE), PROC PDS does not make any distinction between a member name and an alias, other than to report which names in the PDS directory are aliases for which members. If an alias is renamed, it is still an alias. PROC PDS enables you to delete a member that has aliases in the PDS directory, but then other procedures (PROC PDSCOPY, for example) cannot process the aliases.

Example: Deleting and Renaming Members with the PDS Procedure

This example writes the names of the members of USERID.MVS.OUTPUT to the SAS log and then generates a second listing showing the member changes and deletions that are specified by the second PROC step.
filename pdstest 'userid.mvs.output';
proc pds ddname=pdstest;
run;
proc pds ddname=pdstest;
   delete tempout tempout2;
   change mem=out1603;
run;
The following output displays the results:
Deleting and Renaming Members with the PDS Procedure
 1    filename pdstest 'userid.mvs.output';
 2
 3    proc pds ddname=pdstest;
 4    run;
  SAS PROC PDS Version 9.00   04/27/99
    DSNAME=USERID.MVS.OUTPUT  VOL=SER=XXXXXX
    Members (aliases)
    MEM      OUT1601  OUT1602  TEMPOUT  TEMPOUT2
    Tracks Used        1.8
           Unused      1.2
           Total       3.0
    Extents              1
    Directory Blks      11
    Blocks Used          1
 5
 6    proc pds ddname=pdstest;
 7       delete tempout tempout2;
 8       change mem=out1603;
 9    run;
    DSNAME=USERID.MVS.OUTPUT  VOL=SER=XXXXXX
    Members (aliases)
    MEM      OUT1601  OUT1602  OUT1603
    Tracks Used        1.8
           Unused      1.2
           Total       3.0
    Extents              1
    Directory Blks      11
    Blocks Used          1