The Query Use tool provides commands to capture and display the files
used in a Query. Both Query/400 (*QRYDFN) and Query Management
(*QMQRY) objects types are supported. QRYUSE can be helpful when the
files used by a Query have changed and the Query must be re-created.
A solution also exists for determining the fields that are being used
in queries. See the discussion of the CVTQRYSTMT command.
Not all possible SQL statements can be converted by CVTQRYUSE.
Complex sub selection may not be converted.
You must have the Query product to use the tool.
You begin by creating a file structure for use by the QRYUSE tool:
CRTQRYUSE QRYUSELIB(xxx)
The following commands assume the library you named for QRYUSELIB is
on your library list.
You must then convert Query objects in or or more libraries.
CVTQRYUSE LIB(xxx)
Object types *QRYDFN and *QMQRY are searched for and the information
is converted. If multiple files are used in a Query, each file is
written as a separate record.
Once the data is converted, you can display it with:
DSPQRYUSE
A subfile of your Queries is displayed in sequence by:
File to be processed (library and file)
Query name (library and object)
The RTVQMQRY command is used to retrieve the information about a
query to a source member. This contains the basic information of
what files are used. RTVQMQRY causes the last used date of the query
to be changed. To avoid this change, each query is saved to a save
file, restored to library QTEMP, and RTVQMQRY is run against the
QTEMP version.
You can add *QRYDFN and *QMQRY objects to the DSPWHRUSE tool. This
would allow you to see all program and Query references to a file.
See the QUERY option on CRTWHRUSE.
QRYDFN outfile
--------------
If an outfile is specified for a *QRYDFN object, the file name is
included in the QRYUSEP file in field QUOFIL with the library in
QUOLIB. Also see the QUOTYP for the type of file and QUOMBR for the
member name.
For older releases, the information is not available and *UNKNOWN
will appear.
The outfile information is only supported for *QRYDFN objects (not
*QRYMGT).
The approach for accessing this information was described by Jeff
Yanoviak and Phillpe Soriano in their program RTVQRYFR.
CVTQRYSTMT Command
------------------
A separate command is available to convert the statements retrieved
by RTVQMQRY to a program described file named QRYSTMP. Each set of
statements is preceded by a few header lines that identify the query.
The statements appear as retrieved from RTVQMQRY.
The QRYSTMP file can then be viewed and scanned with a command such
as DSPPFM. For example, you can search for strings such as WHERE or
an owner name. Or you can look for all the queries that use a
particular field name.
QRYUSE escape messages you can monitor for
------------------------------------------
None. Escape messages from based on functions will be re-sent.
CRTQRYUSE Command parameters *CMD
-----------------------------
QRYUSELIB The library where the QRYUSE files should be
created.
SRCLIB The source library to use for the QATTDDS file
source. The default is *TAAARC. If a full license
exists, the source is used from the TAA Archive. If
a demonstration license exists, the source is used
from the QATTDDS file in the TAATOOL library.
A specific user library may be named, but the source
file must be QATTDDS.
DLTQRYUSE Command parameters *CMD
-----------------------------
QRYUSELIB The library where the QRYUSE files exist to be
deleted.
CVTQRYUSE Command parameters *CMD
-----------------------------
LIB The libraries to be accessed for *QRYDFN and *QMQRY
objects. Up to 40 libraries may be described.
You may have more than 40 libraries using the same
QRYUSE files by using CVTQRYUSE multiple times and
specifying the REPLACE(*NO) option.
QRYUSELIB The library where the QRYUSE data base files exist.
REPLACE Whether to replace the data in the QRYUSEP file at
the beginning of the command. The default is *YES
which causes the file to be cleared. *NO may be
specified when you have multiple CVTQRYUSE commands
all adding data to the same file.
DSPQRYUSE Command parameters *CMD
-----------------------------
QRYUSELIB The library where the QRYUSE data base files exist.
CVTQRYSTMT Command parameters *CMD
-----------------------------
LIB The libraries to be accessed for *QRYDFN and *QMQRY
objects. Up to 40 libraries may be described.
You may have more than 40 libraries using the same
QRYSTMP file by using CVTQRYSTMT multiple times and
specifying the REPLACE(*NO) option.
QRYSTMPLIB The library where the QRYSTMP file will be created
or already exists. *LIBL is the default. If the
QRYSTMP file does not exist, *LIBL may not be used.
*CURLIB may also be specified.
REPLACE Whether to replace the data in the QRYSTMP file at
the beginning of the command. The default is *YES
which causes the file to be cleared. *NO may be
specified when you have multiple CVTQRYSTMT commands
all adding data to the same file.
RFMQRYUSE Command parameters *CMD
-----------------------------
QRYUSELIB The library where the QRYUSE data base files exist.
WRKLIB The work library that will be used to copy the
current files to. A unique library is desirable so
you can simplify review and deletion.
After the command completes, the old versions of the
files will be retained in the work library. When
you are satisfied with the new versions, delete the
files from the work library.
Restrictions
------------
Not all possible SQL statements can be converted by CVTQRYUSE.
Complex sub selection may not be converted.
Prerequisites
-------------
The following TAA Tools must be on your system:
ADJVAR Adjust variable
CHKACTOBJ Check active object
CHKOBJ2 Check object 2
CVTDAT Convert date
EDTVAR Edit variable
EXTLST Extract list
FILEFDBCK File feedback
HLRMVMSG HLL Remove message
WRKTAA TAA Archive
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDDIAGMSG Send diagnostic message
SNDSTSMSG Send status message
SNDESCMSG Send escape message
UPDPFILE Update PFILE keyword
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CRTQRYUSE *CMD TAAWHRD QATTCMD
DLTQRYUSE *CMD TAAWHRD2 QATTCMD
CVTQRYUSE *CMD TAAWHRD3 QATTCMD
DSPQRYUSE *CMD TAAWHRD4 QATTCMD
CVTQRYSTMT *CMD TAAWHRD5 QATTCMD
RFMQRYUSE *CMD TAAWHRD6 QATTCMD
TAAWHRDC *PGM CLP TAAWHRDC QATTCL
TAAWHRDC2 *PGM CLP TAAWHRDC2 QATTCL
TAAWHRDC3 *PGM CLP TAAWHRDC3 QATTCL
TAAWHRDC4 *PGM CLP TAAWHRDC4 QATTCL
TAAWHRDC5 *PGM CLP TAAWHRDC5 QATTCL
TAAWHRDC6 *PGM CLP TAAWHRDC6 QATTCL
TAAWHRDC13 *PGM CLP TAAWHRDC13 QATTCL
TAAWHRDC14 *PGM CLP TAAWHRDC14 QATTCL
TAAWHRDC15 *PGM CLP TAAWHRDC15 QATTCL
TAAWHRDR3 *PGM RPG TAAWHRDR3 QATTRPG
TAAWHRDR4 *PGM RPG TAAWHRDR4 QATTRPG
TAAWHRDR5 *PGM RPG TAAWHRDR5 QATTRPG
TAAWHRDR6 *PGM RPGLE TAAWHRDR6 QATTRPG
TAAWHRDR13 *PGM RPG TAAWHRDR13 QATTRPG
TAAWHRDP *FILE PF TAAWHRDP QATTDDS
TAAWHRDL *FILE LF TAAWHRDL QATTDDS
TAAWHRDD *FILE DSPF TAAWHRDD QATTDDS
Structure
---------
CRTQRYUSE Cmd
TAAWHRDC CL pgm
DLTQRYUSE Cmd
TAAWHRDC2 CL pgm
CVTQRYUSE Cmd
TAAWHRDC3 CL pgm
TAAWHRDR3 RPG pgm (also used by TAAWHRDC13)
TAAWHRDC13 CL pgm - Reads RTVQMQRY source
TAAWHRDR3 RPG pgm (also used by TAAWHRDC3)
TAAWHRDC14 CL pgm - Uses WRKQRY
TAAWHRDR6 RPGLE pgm - Accesses outfile for QRYDFN
TAAWHRDR13 RPG pgm - Reads SQL etc formats
TAAWHRDC15 CL pgm - Adopts and deletes object in QTEMP
DSPQRYUSE Cmd
TAAWHRDC4 CL pgm
TAAWHRDR4 RPG Pgm
TAAWHRDD Display file
CVTQRYSTMT Cmd
TAAWHRDC5 CL pgm
TAAWHRDR5 RPG Pgm
RFMQRYUSE Cmd
TAAWHRDC6 CL pgm
TAAWHRDR6 RPG Pgm
|