In this example, a data set is renamed. The data set passwords
assigned to the old data set name are deleted. Then two passwords
are assigned to the new data set name. If the data set is not cataloged,
a message is issued indicating that the LOCATE macro instruction ended
unsuccessfully.
72
//ADDPASS JOB ...
//STEP1 EXEC PGM=IEHPROGM,PARM='NOPRINT'
//SYSPRINT DD SYSOUT=A
//DD1 DD VOLUME=SER=222222,DISP=OLD,
// UNIT=disk
//SYSIN DD *
RENAME DSNAME=OLD,VOL=disk=222222,NEWNAME=NEW
DELETEP DSNAME=OLD,PASWORD1=KEY
ADD DSNAME=NEW,PASWORD2=KEY,TYPE=1, X
DATA='SECONDARY IS READ'
ADD DSNAME=NEW,PASWORD2=READ,CPASWORD=KEY,TYPE=2, X
DATA='ASSIGNED TO J. DOE'
/*
The utility control statements are discussed below:
- RENAME specifies that the data set called OLD is renamed NEW.
The operator is required to supply a password to rename the old data
set.
- DELETEP specifies that the entry for the password KEY is deleted.
Because KEY is a control password in this example, all the password
entries for the data set name are deleted. The VOL parameter is not
needed because the protection status of the data set as set in the
DSCB is not to be changed; read/write protection is presently set
in the DSCB, and read/write protection is desired when the passwords
are reassigned under the new data set name.
- The ADD statements specify that entries are added for passwords
KEY and READ. KEY becomes the control password and allows both read
and write access to the data set. READ becomes a secondary password
and allows only read access to the data set. The VOL parameter is
not needed, because the protection status of the data set is still
set in the DSCB.