How can I rename all dataset names in the MUF

Document ID : KB000096558
Last Modified Date : 18/05/2018
Show Technical Document Details
Question:
How do I change the dataset names of all database and system files in the MUF?
I want to rename all files by adding a new prefix to the DSN.
Our current HLQ for the Datacom databases is DATCOM.**
I want to rename all files to NEWHLQ.DATCOM.**
 
Answer:
The dataset names are stored in the Datacom CXX. You can change the dataset names by running DBUTLTY with command CXXMAINT ALTER DSN. The MUF needs to be up to do this but the DBID must be closed. Refer to KB000030470 which has detailed steps on how to do it.

You can get current dataset name information from the CXX by running DBSQLPR with the following statement: 
SELECT DBID, AREA_NAME, DATASET_NAME FROM SYSADM.DIR_DATASET WHERE DBID = nnnn; 

or for all datset names: 
SELECT DBID, AREA_NAME, DATASET_NAME FROM SYSADM.DIR_DATASET; 

Change the name of all the datasets listed, except for the CXX, and ones marked * which are not used and the ones marked *VIRTUAL*. 

If you specify SIMPLIFY_MODE=YES in the DBSIDPR, the model data set name for the CXX (also LXX and FXX) is specified in the DSN_XXX= parameter. You will have to change the name there as well. 

You can use SQL to generate the required DBUTLTY CXXMAINT statement to rename the files. 
The following SQL command and JCL will add the prefix "NEWHLQ." to existing dataset names. It will also split the command into 2 lines: 
//SQLEXEC EXEC PGM=DBSQLPR, 
// PARM='PRTWIDTH=133,INPUTWIDTH=72,PAGELEN=56,NOPAGEHDR,NOCOLHDR' 
//STEPLIB DD DISP=SHR,DSN=DATACOM.CUSLIB 
//        DD DISP=SHR,DSN=DATACOM.CABDLOAD 
//SYSUDUMP DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//STDERR DD SYSOUT=* 
//STDOUT DD SYSOUT=*,LRECL=70     << Don't change this
//OPTIONS DD * 
AUTHID=SYSUSR 
/* 
//SYSIN DD * 
SELECT 'CXXMAINT DBID='||DIGITS(DBID)|| 
',AREA='||AREA_NAME|| 
',OPTION=ALTER, ', 
' DSN=NEWHLQ.'||DATASET_NAME 
FROM SYSADM.DIR_DATASET 
WHERE DATASET_NAME NOT LIKE '*%' 
AND DBID > 0; 
/*
Additional Information:
KB000030470 - How to rename CA Datacom database files