How to change the owner of CA Dataquery queries in batch. (z/OS 2.1 and higher)

Document ID : KB000009789
Last Modified Date : 22/02/2018
Show Technical Document Details
Introduction:

It is sometimes necessary to re-assign a user's Queries their another person. If there are only a few, it can easily be done through the online system. However, if there are many, it is much easier to do this in a batch process. This article explains a process to do that.

Environment:
This is for z/OS 2.1 and higher.
Instructions:

In order to rename the owner of these queries, the process is basically the same for Public and Private queries - take a backup of the queries for the "From" user, remove the "From" user queries, and then restore the backup to the "To" user. The only thing to be aware of is if your "To" user already has queries with the same member name - you have to decide how to handle that. If you want to replace that member with the one from the backup, then you would have to delete the "to" user version or rename it manually before running the job.

If you want to be most careful, you can take a DBUTLTY backup of the DQQ area before running this. 

Here is a sample JCL member that you can use. It uses in-stream data symbolics, so will only work with z/OS 2.1 and above.

//* - - - - - -C- - - - - - - - - - - - - - - - - - - - - - - - - - -7-
//*                                                                   
//  EXPORT SYMLIST=(DQBKPQ,NAMEF,NAMET,DQLOGIN,DQPASS)                
//   SET NAMEF='FFFFFFFF'                       <- "FROM" USER NAME   
//   SET NAMET='TTTTTTTT'                       <- "TO"   USER NAME   
//   SET DQBKPQ='YOUR-QUERY-BACKUP-FILE'        <- SELECTED QUERY BKP 
//   SET BKPUNI='UNIT=3390,VOL=SER=XXXXXX,'     <- BKP FILE ATTRIBUTES
//   SET BKPSPC='SPACE=(CYL,(200,20),RLSE)'     <- BKP FILE ATTRIBUTES
//   SET DQLOGIN='DATACOM-INSTALL'              <- DQ LOGIN NAME      
//   SET DQPASS='NEWUSER'                       <- DQ LOGIN PASSWORD  
//   SET STEPLIB1='YOUR-DB-CUSLIB'              <- DB CUSLIB          
//   SET STEPLIB2='YOUR-DB-CABDLOAD'            <- DB LOAD            
//   SET STEPLIB3='YOUR-IPC-CAVQLOAD'           <- IPC LOAD           
//*                                                                    
//*===================================================================*
//*>>>>>   DQLIB        S T A R T   O F   P R O C                <<<<<*
//*===================================================================*
//DQLIB    PROC                                                        
//DQLIB    EXEC PGM=DQLIBRMT,COND=(0,LT),REGION=4M                    
//STEPLIB  DD  DISP=SHR,DSN=&STEPLIB1                                 
//         DD  DISP=SHR,DSN=&STEPLIB2                                  
//         DD  DISP=SHR,DSN=&STEPLIB3                                 
//SYMBOLS  DD  SYSOUT=*                                               
//SYSPRINT DD  SYSOUT=*                                               
//SNAPER   DD  SYSOUT=*                                                
//DQLIB    PEND                                                       
//*===================================================================*
//*>>>>>   DQLIB          E N D   O F   P R O C                  <<<<<*
//*===================================================================*
//*                                                                   
//* - - - - - -C- - - - - - - - - - - - - - - - - - - - - - - - - - -7-
//* DELETE BACKUP FILE                                                
//DELFILE  EXEC PGM=IDCAMS,REGION=512K                                
//SYMBOLS  DD  SYSOUT=*                                               
//SYSPRINT DD  SYSOUT=*                                                
//SYSIN    DD  *,SYMBOLS=(JCLONLY,SYMBOLS)                            
 DELETE &DQBKPQ  SCRATCH                                              
 SET MAXCC=0                                                          
/*                                                                     
//* - - - - - -C- - - - - - - - - - - - - - - - - - - - - - - - - - -7-
//* BACKUP ALL QUERIES FOR DESIGNATED USER                            
//DQLIB#01 EXEC PROC=DQLIB,COND=(0,LT),REGION=4M                      
//DQBKPFIL DD  DISP=(,CATLG,DELETE),DSN=&DQBKPQ,                      
//             &BKPUNI,                                               
//             &BKPSPC                                                
//SYSIN    DD  *,SYMBOLS=(JCLONLY,SYMBOLS)                            
SIGN/ON &DQLOGIN PASSWORD &DQPASS                                     
BACKUP    NAME=&NAMEF,TYPE=QUERY                                      
/*                                                                     
//* - - - - - -C- - - - - - - - - - - - - - - - - - - - - - - - - - -7-
//* REMOVE ALL QUERIES FOR DESIGNATED USER                            
//DQLIB#02 EXEC PROC=DQLIB,COND=(0,LT),REGION=4M                      
//SYSIN    DD  *,SYMBOLS=(JCLONLY,SYMBOLS)                            
SIGN/ON &DQLOGIN PASSWORD &DQPASS                                     
REMOVE    NAME=&NAMEF,TYPE=QUERY                                      
/*                                                                     
//* - - - - - -C- - - - - - - - - - - - - - - - - - - - - - - - - - -7-
//* RESTORE ALL BACKUP QUERIES TO NEW USER AND PRINT DIRECTORY        
//DQLIB#03 EXEC PROC=DQLIB,COND=(0,LT),REGION=4M                      
//DQRSTFIL DD  DISP=SHR,DSN=&DQBKPQ                                   
//SYSIN    DD  *,SYMBOLS=(JCLONLY,SYMBOLS)                            
SIGN/ON &DQLOGIN PASSWORD &DQPASS                                     
RESTORE   NAME=&NAMET                                                  
REPORT    TITLE=DIRECTORY                                             
/*                                                                    
//                                                                    

 

Additional Information:
File Attachments:
TEC1983717.zip