Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Find file in query

Find all the queries that accessed a file that is being replaced by a new enhanced application. I developed the following command.


 
		 GETQRY
             PGM        PARM(&LIBRARY &FILE)                            
             DCL        VAR(&LIBRARY) TYPE(*CHAR) LEN(10)               
             DCL        VAR(&FILE) TYPE(*CHAR) LEN(10)                  
             DCLF       FILE(QTEMP/QRYOBJS)                             
             DLTF       FILE(QTEMP/QRYOBJS)                             
             MONMSG     CPF0000                                         
             DLTF       FILE(QTEMP/&LIBRARY)                            
             MONMSG     CPF0000                                         
CRTSRCPF   FILE(QTEMP/&LIBRARY)                            
 DSPOBJD    OBJ(&LIBRARY/*ALL) OBJTYPE(*QRYDFN) +           
                          DETAIL(*FULL) OUTPUT(*OUTFILE) +       
                           OUTFILE(QTEMP/QRYOBJS)                        
  BEGIN:   RCVF      /* GET QUERY NAME AND LIBRARY NAME */            
 		 /* IF END OF FILE REACHED, EXIT LOOP        */ 
            MONMSG   CPF0864  EXEC(GOTO EOF)                           
RTVQMQRY   QMQRY(&ODLBNM/&ODOBNM) +                        
                        	   SRCFILE(QTEMP/&LIBRARY) ALWQRYDFN(*ONLY)      
	 GOTO       CMDLBL(BEGIN)                                   
EOF:	FNDSTRPDM  STRING(&FILE) FILE(QTEMP/&LIBRARY) 
MBR(*ALL)  OPTION(*NONE) PRTMBRLIST(*YES)                
            ENDPGM                                                     
Use the DSPOBJD command to create an outfile in QTEMP.  While in PDM, press CMD18 to change defaults and change Compile in Batch to "N".  Compile GETQRY.
(Don't forget to set the compile option default back to "Y" when done)
GETQRYPRM
             PGM        PARM(&LIBRARY &FILE)                            
             DCL        VAR(&LIBRARY) TYPE(*CHAR) LEN(10)               
             DCL        VAR(&FILE) TYPE(*CHAR) LEN(10)                  
             SBMJOB     CMD(CALL PGM(GETQRY) PARM(&LIBRARY &FILE))      
             ENDPGM                                                             
Compile program GETQRYPRM.  
FFINQ
          CMD        PROMPT('Find File in Query')                  
          PARM       KWD(LIBRARY) TYPE(*CHAR) LEN(10) +            
                       PROMPT('Library containing queries')        
          PARM       KWD(FILE) TYPE(*CHAR) LEN(10) +               
                       PROMPT('Name of file to search for')  

Finally, create the command FFINQ, specifying GETQRYPRM as the program to process command. The resulting "Programming Development Manager -- Member list" report will list all the queries containing the specified file name.

Dig Deeper on iSeries system performance and monitoring

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close