× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



It's the query options file.

Dan W.

 

Creating the QAQQINI query options file

Each system is shipped with a QAQQINI template file in library QSYS. The QAQQINI file in QSYS is to be used as a template when creating all user specified QAQQINI files. To create your own QAQQINI file, use the CRTDUPOBJ command to create a copy of the QAQQINI file in the library that will be specified on the CHGQRYA QRYOPTLIB parameter. The file name must remain QAQQINI, for example:

CRTDUPOBJ OBJ(QAQQINI) 
FROMLIB(QSYS) 
OBJTYPE(*FILE) 
TOLIB(MYLIB) 
DATA(*YES) 

Because system-supplied triggers are attached to the QAQQINI file in QSYS it is imperative that the only means of copying the QAQQINI file is through the CRTDUPOBJ CL command.

Note: It is recommended that the file QAQQINI, in QSYS, not be modified. This is the original template that is to be duplicated into QUSRSYS or a user specified library for use.

QAQQINI query options file format

Query Options File:

                                     UNIQUE 
R QAQQINI                            TEXT('Query options + file') 
 
QQPARM                    256A       VARLEN(10) + 
                                     TEXT('Query +  
                                           option parameter') + 
                                     COLHDG('Parameter') 
QQVAL                     256A       VARLEN(10) + 
                                     TEXT('Query option + 
                                           parameter value') + 
                                     COLHDG('Parameter Value') 
 QQTEXT                   1000G      VARLEN(100) + 
                                     TEXT('Query + 
                                           option text') + 
                                     ALWNULL + 
                                     COLHDG('Query Option' + 
                                            'Text') + 
                                     CCSID(13488) + 
                                     DFT(*NULL) 
 K QQPARM 

The QAQQINI file shipped in the library QSYS has been pre-populated with the following rows:

Table 8. QAQQINI File Records

Description
QQPARM QQVAL
APPLY_REMOTE *DEFAULT
ASYNC_JOB_USAGE *DEFAULT
FORCE_JOIN_ORDER *DEFAULT
MESSAGES_DEBUG *DEFAULT
OPTIMIZE_STATISTIC_LIMITATION *DEFAULT
PARALLEL_DEGREE *DEFAULT
PARAMETER_MARKER_CONVERSION *DEFAULT
QUERY_TIME_LIMIT *DEFAULT
UDF_TIME_OUT *DEFAULT

Setting the options within the query options file

The QAQQINI file query options can be modified with the INSERT, UPDATE, or DELETE SQL statements.

For the following examples, a QAQQINI file has already been created in library MyLib. To update an existing row in MyLib/QAQQINI use the UPDATE SQL statment. This example sets MESSAGES_DEBUG = *YES so that the query optimizer will print out the optimizer debug messages:

UPDATE MyLib/QAQQINI SET QQVAL='*YES' 
WHERE QQPARM='MESSAGES_DEBUG'

To delete an existing row in MyLib/QAQQINI use the DELETE SQL statement. This example removes the QUERY_TIME_LIMIT row from the QAQQINI file:

DELETE FROM MyLib/QAQQINI 
WHERE QQPARM='QUERY_TIME_LIMIT'

To insert a new row into MyLib/QAQQINI use the INSERT SQL statement. This example adds the QUERY_TIME_LIMIT row with a value of *NOMAX to the QAQQINI file:

 INSERT INTO MyLib/QAQQINI 
VALUES('QUERY_TIME_LIMIT','*NOMAX','New time limit set by DBAdmin')

QAQQINI query options

The following table summarizes the query options that can be specified on the QAQQINI command:

Table 9. Query Options Specified on QAQQINI Command

Parameter Value Description
APPLY_REMOTE *DEFAULT The default value is set to *NO.
*NO The CHGQRYA attributes for the job are not applied to the remote jobs. The remote jobs will use the attributes associated to them on their systems.
*YES The query attributes for the job are applied to the remote jobs used in processing database queries involving distributed tables. For attributes where *SYSVAL is specified, the system value on the remote system is used for the remote job. This option requires that, if CHGQRYA was used for this job, the remote jobs must have authority to use the CHGQRYA command.
ASYNC_JOB_USAGE *DEFAULT The default value is set to *LOCAL.
*LOCAL Asynchronous jobs may be used for database queries that involve only tables local to the system where the database queries are being run. In addition, for queries involving distributed tables, this option allows the communications required to be asynchronous. This allows each system involved in the query of the distributed tables to run its portion of the query at the same time (in parallel) as the other systems.
*DIST Asynchronous jobs may be used for database queries that involve distributed tables.
*ANY Asynchronous jobs may be used for any database query.
*NONE No asynchronous jobs are allowed to be used for database query processing. In addition, all processing for queries involving distributed tables occurs synchronously. Therefore, no inter-system parallel processing will occur.
FORCE_JOIN_ORDER *DEFAULT The default is set to *NO.
*NO Allow the optimizer to re-order join tables.
*YES Do not allow the query optimizer to re-order join tables as part of its optimization process. The join will occur in the order in which the tables were specified in the query.
MESSAGES_DEBUG *DEFAULT The default is set to *NO.
*NO No debug messages are to be displayed.
*YES Issue all Query Optimizer debug messages.

OPTIMIZE_STATISTIC_
LIMITATION

*DEFAULT The amount of time spent in gathering index statistics is determined by the query optimizer.
*NO No index statistics will be gathered by the query optimizer. Default statistics will be used for optimization. (Use this option sparingly.)
*PERCENTAGE integer value Specifies the maximum percentage of the index that will be searched while gathering statistics. Valid values for are 1 to 99.
*MAX_NUMBER_ OF_RECORDS_ ALLOWED integer value Specifies the largest table size, in number of rows, for which gathering statistics is allowed. For tables with more rows than the specified value, the optimizer will not gather statistics and will use default values.
PARALLEL_DEGREE *DEFAULT The default value is set to *SYSVAL.
*SYSVAL The processing option used is set to the current value of the system value, QQRYDEGREE.
*IO Any number of tasks can be used when the database query optimizer chooses to use I/O parallel processing for queries. SMP parallel processing is not allowed.
*OPTIMIZE The query optimizer can choose to use any number of tasks for either I/O or SMP parallel processing to process the query or database table index build, rebuild, or maintenance. SMP parallel processing is used only if the system feature, DB2 Symmetric Multiprocessing for OS/400, is installed. Use of parallel processing and the number of tasks used is determined with respect to the number of processors available in the system, this job has a share of the amount of active memory available in the pool in which the job is run, and whether the expected elapsed time for the query or database table index build or rebuild is limited by CPU processing or I/O resources. The query optimizer chooses an implementation that minimizes elapsed time based on the job has a share of the memory in the pool.
*MAX The query optimizer chooses to use either I/O or SMP parallel processing to process the query. SMP parallel processing will only be used if the system feature, DB2 Symmetric Multiprocessing for OS/400, is installed. The choices made by the query optimizer are similar to those made for parameter value *OPTIMIZE except the optimizer assumes that all active memory in the pool can be used to process the query or database table index build, rebuild, or maintenance.
*NONE No parallel processing is allowed for database query processing or database table index build, rebuild, or maintenance.

PARAMETER_MARKER_
CONVERSION

*DEFAULT The default value is set to *NO.
*NO Constants cannot be implemented as parameter markers.
*YES Constants can be implemented as parameter markers.

QUERY_TIME_LIMIT

*DEFAULT The default value is set to *SYSVAL.
*SYSVAL The query time limit for this job will be obtained from the system value, QQRYTIMLMT.
*NOMAX There is no maximum number of estimated elapsed seconds.
integer value Specifies the maximum value that is checked against the estimated number of elapsed seconds required to run a query. If the estimated elapsed seconds is greater than this value, the query is not started. Valid values range from 0 through 2147352578.

UDF_TIME_OUT

*DEFAULT The amount of time to wait is determined by the database. The default is 30 seconds.
*MAX The maximum amount of time that the database will wait for the UDF to finish.
integer value Specify the number of seconds that the database should wait for a UDF to finish. If the value given exceeds the database maximum wait time, the maximum wait time will be used by the database. Minimum value is 1 and maximum value is system defined.

QAQQINI query options file authority requirements

QAQQINI is shippped with a *PUBLIC *USE authority. This allows users to view the query options file, but not change it. It is recommended that only the system or database administrator have *CHANGE authority to the QAQQINI query options file.

The query options file, which resides in the library specified on the CHGQRYA CL command QRYOPTLIB parameter, is always used by the query optimizer. This is true even if the user has no authority to the query options library and file. This provides the system administrator with an additional security mechanism.

When the QAQQINI file resides in the library QUSRSYS the query options will effect all of the query users on the system. To prevent anyone from inserting, deleting, or updating the query options, the system administrator should remove update authority from *PUBLIC to the file. This will prevent users from changing the data in the file.

When the QAQQINI file resides in a user library, specified on the CHGQRYA CL command option QRYOPTLIB, the query options will effect all of the querys run for that user's job. To prevent the query options from being retrieved from a particular library the system administrator can revoke authority to the CHGQRYA CL command.

QAQQINI file system supplied triggers

The query options file QAQQINI file uses a system-supplied trigger program in order to process any changes made to the file. A trigger cannot be removed from or added to the file QAQQINI.

If an error occurs on the update of the QAQQINI file (an INSERT, DELETE, or UPDATE operation), the following SQL0443 diagnostic message will be issued:

Trigger program or external routine detected an error.
----- Original Message ----- 
Sent: Friday, August 17, 2001 3:25 PM
Subject: SQLRPGLE program giving strange message in joblog


(OS400 V4R4)  I've got an SQLRPGLE program which I'm trying to use to update a file.  I'm getting the following in my job log:

                         Additional Message Information                        
                                                                               
 Message ID . . . . . . :   CPI433A                                            
 Date sent  . . . . . . :   08/17/01      Time sent  . . . . . . :   15:20:05  
                                                                               
 Message . . . . :   Unable to retrieve query options file.                    
                                                                               
 Cause . . . . . :   Unable to retrieve the query options from member QAQQINI  
   in file QAQQINI in library QUSRSYS for reason code 2.  The reason codes and
   their meanings follow:                                                      
     1 - Library QUSRSYS was not found.                                        
     2 - File QAQQINI in library QUSRSYS was not found.                        


What is the QAQQINI file?  The update works if I key the update statement in using STRSQL, but fails when I run the same statement from my program.

Thanks!

Tom Hightower
Solutions, Inc
http://www.simas.com
------------
If Bill Gates had a dime for every time a Windows box crashed... oh, wait - he does.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.