ibm-information-center/dist/eclipse/plugins/i5OS.ic.cl_5.4.0.1/chgqrya.htm

486 lines
23 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Change Query Attributes (CHGQRYA)</title>
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body bgcolor="white">
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<a name="CHGQRYA.Top_Of_Page"></a>
<h2>Change Query Attributes (CHGQRYA)</h2>
<table width="100%">
<tr>
<td valign="top" align="left"><b>Where allowed to run: </b>All environments (*ALL)<br>
<b>Threadsafe: </b>Yes
</td>
<td valign="top" align="right">
<a href="#CHGQRYA.PARAMETERS.TABLE">Parameters</a><br>
<a href="#CHGQRYA.COMMAND.EXAMPLES">Examples</a><br>
<a href="#CHGQRYA.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="CHGQRYA"></a>
<p>The Change Query Attributes (CHGQRYA) command specifies attributes for database queries and database file keyed access path builds, rebuilds, and maintenance that are run in a job. Database queries include the open of a SQL view and the running of SQL data manipulation statements.
</p>
<p><b>Restrictions:</b> You must have job control (*JOBCTL) special authority to use this command.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="CHGQRYA.PARAMETERS.TABLE">Parameters</a></h3>
<table border="1" cellpadding="4" cellspacing="0">
<!-- col1="10" col2="15" col3="30" col4="10" -->
<tr>
<th bgcolor="aqua" valign="bottom" align="left">Keyword</th>
<th bgcolor="aqua" valign="bottom" align="left">Description</th>
<th bgcolor="aqua" valign="bottom" align="left">Choices</th>
<th bgcolor="aqua" valign="bottom" align="left">Notes</th>
</tr>
<tr>
<td valign="top" rowspan="4"><a href="#CHGQRYA.JOB"><b>JOB</b></a></td>
<td valign="top">Job name</td>
<td valign="top">Single values: <b><u>*</u></b><br>Other values: <i>Qualified job name</i></td>
<td valign="top" rowspan="4">Optional, Key</td>
</tr>
<tr>
<td valign="top">Qualifier 1: Job name</td>
<td valign="top"><i>Name</i></td>
</tr><tr>
<td valign="top">Qualifier 2: User</td>
<td valign="top"><i>Name</i></td>
</tr><tr>
<td valign="top">Qualifier 3: Number</td>
<td valign="top">000000-999999</td>
</tr><tr>
<td valign="top"><a href="#CHGQRYA.QRYTIMLMT"><b>QRYTIMLMT</b></a></td>
<td valign="top">Query processing time limit</td>
<td valign="top">0-2147352578, <b><u>*SAME</u></b>, *NOMAX, *SYSVAL</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#CHGQRYA.DEGREE"><b>DEGREE</b></a></td>
<td valign="top">Parallel processing degree</td>
<td valign="top">Single values: <b><u>*SAME</u></b>, *NONE, *IO, *OPTIMIZE, *MAX, *SYSVAL, *ANY<br>Other values: <i>Element list</i></td>
<td valign="top" rowspan="3">Optional</td>
</tr>
<tr>
<td valign="top">Element 1: Processing option</td>
<td valign="top">
*NBRTASKS</td>
</tr>
<tr>
<td valign="top">Element 2: Number of tasks</td>
<td valign="top">
2-9999</td>
</tr>
<tr>
<td valign="top"><a href="#CHGQRYA.ASYNCJ"><b>ASYNCJ</b></a></td>
<td valign="top">Asynchronous job usage</td>
<td valign="top"><b><u>*SAME</u></b>, *DIST, *LOCAL, *ANY, *NONE</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#CHGQRYA.APYRMT"><b>APYRMT</b></a></td>
<td valign="top">Apply CHGQRYA to remote</td>
<td valign="top"><b><u>*SAME</u></b>, *YES, *NO</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#CHGQRYA.QRYOPTLIB"><b>QRYOPTLIB</b></a></td>
<td valign="top">Query options file library</td>
<td valign="top"><i>Name</i>, <b><u>*SAME</u></b></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#CHGQRYA.QRYSTGLMT"><b>QRYSTGLMT</b></a></td>
<td valign="top">Query temporary storage limit</td>
<td valign="top">0-2147352578, <b><u>*SAME</u></b>, *NOMAX</td>
<td valign="top">Optional</td>
</tr>
</table>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="CHGQRYA.JOB"></a>
<h3>Job name (JOB)</h3>
<p>Specifies the job for which the query attributes are to be changed.
</p>
<p><b>Single values</b>
</p>
<dl>
<dt><b><u>*</u></b></dt>
<dd>The query attributes of the job running the CHGQRYA command are to be changed.
</dd>
</dl>
<p><b>Qualifier 1: Job name</b>
</p>
<dl>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the job whose query attributes are to be changed. If no job user name or job number qualifiers are specified, all of the jobs currently in the system are searched for the specified simple job name. If duplicates of the specified job name are found, you need to specify a job user name or job number that uniquely identifies the job to be changed.
</dd>
</dl>
<p><b>Qualifier 2: User</b>
</p>
<dl>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the user of the job whose query attributes are to be changed.
</dd>
</dl>
<p><b>Qualifier 3: Number</b>
</p>
<dl>
<dt><b><i>000000-999999</i></b></dt>
<dd>Specify the number of the job whose query attributes are to be changed.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CHGQRYA.QRYTIMLMT"></a>
<h3>Query processing time limit (QRYTIMLMT)</h3>
<p>Specifies a limit for database queries allowed to be started based on the estimated number of elapsed seconds that the query requires to process.
</p>
<p>The initial value of the QRYTIMLMT attribute for a job is *SYSVAL.
</p>
<dl>
<dt><b><u>*SAME</u></b></dt>
<dd>The value does not change.
</dd>
<dt><b>*NOMAX</b></dt>
<dd>There is no maximum number of estimated elapsed seconds.
</dd>
<dt><b>*SYSVAL</b></dt>
<dd>The query time limit should be obtained from the system value QQRYTIMLMT.
</dd>
<dt><b><i>0-2147352578</i></b></dt>
<dd>Specify 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.
<p>When 0 is specified all database queries issue a CPA4259 inquiry message. Setting a query time limit of 0 can be useful when attempting to tune database queries for better performance because the technical description of the CPA4259 inquiry message explains the type of access plan used by the query.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CHGQRYA.DEGREE"></a>
<h3>Parallel processing degree (DEGREE)</h3>
<p>Specifies the parallel processing option and, optionally, the number of tasks that can be used when running database queries and database file keyed access path builds, rebuilds, and maintenance in the job.
</p>
<p>The specified parallel processing option determines the types of parallel processing allowed. There are two types of parallel processing:
</p>
<ol>
<li><b>Input/Output (I/O) parallel processing</b>
<p>With I/O parallel processing, the database manager uses multiple tasks for each query to do the I/O processing. The central processor unit (CPU) processing is still done serially.
</p>
</li>
<li><b>Symmetric Multiprocessing (SMP)</b>
<p>SMP assigns both the CPU and I/O processing to tasks that will run the query in parallel. Actual CPU parallelism requires a system with multiple processors. SMP parallelism can only be used if the system feature, DB2 Symmetric Multiprocessing for OS/400, is installed.
</p>
<p>Use of SMP parallelism can affect the order in which records are returned. Applications which depend on records being returned from database queries in arrival sequence or keyed access path sequence that have not explicitly defined the ordering sequence in the query, should not be run in jobs which have specified a parallel processing option that enables SMP processing.
</p>
</li>
</ol>
<p>The initial value of the DEGREE attribute for a job is *SYSVAL.
</p>
<p><b>Single values</b>
</p>
<dl>
<dt><b><u>*SAME</u></b></dt>
<dd>The value does not change.
</dd>
<dt><b>*NONE</b></dt>
<dd>No parallel processing is allowed for database query processing or database file keyed access path build, rebuild, or maintenance.
</dd>
<dt><b>*IO</b></dt>
<dd>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.
</dd>
<dt><b>*OPTIMIZE</b></dt>
<dd>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 file keyed access path 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's 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 file keyed access path 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's share of the memory in the pool.
</dd>
<dt><b>*MAX</b></dt>
<dd>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 file keyed access path build, rebuild, or maintenance.
</dd>
<dt><b>*SYSVAL</b></dt>
<dd>The processing option used is set to the current value of the system value, QQRYDEGREE.
</dd>
<dt><b>*ANY</b></dt>
<dd>This value has the same meaning as *IO. The *ANY value is maintained for compatibility with prior releases.
</dd>
</dl>
<p><b>Element 1: Processing option</b>
</p>
<dl>
<dt><b>*NBRTASKS</b></dt>
<dd>The number of tasks to be used for SMP parallel processing is specified by the second element of the DEGREE parameter.
</dd>
</dl>
<p><b>Element 2: Number of tasks</b>
</p>
<dl>
<dt><b><i>2-9999</i></b></dt>
<dd>Specify the number of tasks to be used when the query optimizer chooses to use SMP parallel processing to process a query. I/O parallelism is also allowed. SMP parallel processing is used only if the system feature, DB2 Symmetric Multiprocessing for OS/400, is installed.
<p>Using a number of tasks less than the number of processors available on the system restricts the number of processors used simultaneously for running a given query or database file keyed access path build, rebuild, or maintenance. A larger number of tasks ensures that the query or database file keyed access path build, rebuild, or maintenance is allowed to use all of the processors available on the system to run the query. Too many tasks can degrade performance because of the over-commitment of active memory and the overhead cost of managing all of the tasks.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CHGQRYA.ASYNCJ"></a>
<h3>Asynchronous job usage (ASYNCJ)</h3>
<p>Specifies the circumstances in which asynchronous (temporary writer) jobs can be used to help process database queries in the job.
</p>
<p>The specified usage option determines which types of database queries can use asynchronous jobs (running in parallel) to help in completing the query.
</p>
<p>An asynchronous job is a separate job on the system that handles query requests from jobs that are running database queries. For each request, the asynchronous job processes the request and puts the results into a temporary file. This intermediate temporary file is then used by the main job to complete the database query.
</p>
<p>The advantage of using an asynchronous job is that it can be processing its request at the same time (in parallel) that the main job is processing another step of the database query. The disadvantage of using an asynchronous job is that it may encounter a situation that it cannot handle in the same way as the main job. For example, the asynchronous job may receive an inquiry message from which it would have to cancel, whereas the main job could have chosen to ignore the message and continue.
</p>
<p>There are two different types of database queries that can use asynchronous jobs:
</p>
<ol>
<li><b>Distributed queries</b>
<p>These are database queries that involve distributed files. Distributed files are provided through the system feature DB2 Multi-System for OS/400.
</p>
</li>
<li><b>Local queries</b>
<p>These are database queries that involve only files local to the system where the database queries are being run.
</p>
</li>
</ol>
<p>The initial value of the ASYNCJ attribute for a job is *LOCAL.
</p>
<dl>
<dt><b><u>*SAME</u></b></dt>
<dd>The value does not change.
</dd>
<dt><b>*DIST</b></dt>
<dd>Asynchronous jobs may be used for database queries that involve distributed files.
</dd>
<dt><b>*LOCAL</b></dt>
<dd>Asynchronous jobs may be used for database queries that involve only files local to the system where the database queries are being run.
<p>In addition, for queries involving distributed files, this option allows the communications required to be asynchronous. This allows each system involved in the query of the distributed files to run its portion of the query at the same time (in parallel) as the other systems.
</p>
</dd>
<dt><b>*ANY</b></dt>
<dd>Asynchronous jobs may be used for any database query.
</dd>
<dt><b>*NONE</b></dt>
<dd>No asynchronous jobs are allowed to be used for database query processing.
<p>In addition, all processing for queries involving distributed files occurs synchronously. Therefore, no inter-system parallel processing will occur.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CHGQRYA.APYRMT"></a>
<h3>Apply CHGQRYA to remote (APYRMT)</h3>
<p>Specifies, for database queries involving distributed files, whether or not the query attributes are applied to the jobs on the remote systems associated with this job. The query attributes applied are those from this command and those specified in the QAQQINI file in the library specified for the <b>Query options file library (QRYOPTLIB)</b> parameter.
</p>
<p>The specified option determines whether the query attributes specified for the job are applied to the associated jobs on the systems applicable to the distributed file or files.
</p>
<p>The initial value of the APYRMT attribute for a job is *YES.
</p>
<dl>
<dt><b><u>*SAME</u></b></dt>
<dd>The value does not change.
</dd>
<dt><b>*YES</b></dt>
<dd>The query attributes for the job are applied to the remote jobs used in processing database queries involving distributed files. The query attributes applied are those specified on this command and those in the QAQQINI file in the library specified for the QRYOPTLIB parameter. 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.
</dd>
<dt><b>*NO</b></dt>
<dd>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.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CHGQRYA.QRYOPTLIB"></a>
<h3>Query options file library (QRYOPTLIB)</h3>
<p>Specifies which library currently contains, or will contain, the query options file (QAQQINI).
</p>
<p>The query options file is used to set or modify the attributes used by the Query Optimizer that will determine how a query will be implemented in the job specified.
</p>
<p>The query options file uses a system-supplied trigger program associated with the file QAQQINI in order to process any changes made to the file. A template for the file is shipped in the library QSYS with the base trigger program already attached. In order to maintain and use the query options file correctly, it is recommended that Create Duplicate Object (CRTDUPOBJ) be used to create a copy of the file QAQQINI into the library specified for this parameter.
</p>
<p>For more information, refer to the SQL Programming information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter or Database information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
</p>
<p>The initial value of the QRYOPTLIB attribute for a job is QUSRSYS.
</p>
<dl>
<dt><b><u>*SAME</u></b></dt>
<dd>The value does not change.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the library where the QAQQINI query options file is (or will be) located.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="CHGQRYA.QRYSTGLMT"></a>
<h3>Query temporary storage limit (QRYSTGLMT)</h3>
<p>Specifies a temporary storage limit for database queries. If the query is expected to use more than the specified amount of storage, the query will not be allowed to start. The value specified is in megabytes.
</p>
<p>The initial value of the QRYSTGLMT attribute for a job is *NOMAX.
</p>
<dl>
<dt><b><u>*SAME</u></b></dt>
<dd>The value does not change.
</dd>
<dt><b>*NOMAX</b></dt>
<dd>There is no maximum temporary storage limit.
</dd>
<dt><b><i>0-2147352578</i></b></dt>
<dd>Specify the maximum amount of temporary storage that may be used. This value is checked against the estimated amount of temporary storage required to run the query, as calculated by the query optimizer. If the estimated amount of temporary storage is greater than this value, the query is not started. The value specified is in megabytes.
<p>When 0 is specified most database queries will exceed the specified temporary storage limit and will issue a CPA4259 inquiry message. Setting a query temporary storage limit of 0 can be useful when attempting to tune database queries for better performance because the technical description of the CPA4259 inquiry message explains the type of access plan used by the query.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="CHGQRYA.COMMAND.EXAMPLES">Examples</a> </h3>
<p><b>Example 1: Changing the Query Time Limit</b>
</p>
<p>
<pre>
CHGQRYA QRYTIMLMT(60)
</pre>
</p>
<p>This command changes the query time limit to 60 seconds.
</p>
<p><b>Example 2: Controlling Query and Database Parallel Processing</b>
</p>
<p>
<pre>
CHGQRYA DEGREE(*IO)
</pre>
</p>
<p>This command specifies that any number of tasks may be used when the database query optimizer chooses to use I/O parallel processing for queries. SMP parallel processing is not allowed.
</p>
<p><b>Example 3: Controlling Query Parallel Processing</b>
</p>
<p>
<pre>
CHGQRYA DEGREE(*OPTIMIZE)
</pre>
</p>
<p>This command specifies that the query optimizer can choose to use any number of tasks for either I/O or SMP parallel processing to process a query, database file keyed access path build or rebuild, or database file I/O keyed access path maintenance. SMP parallel processing will only be used if the system feature DB2 Symmetric Multiprocessing is installed.
</p>
<p><b>Example 4: Controlling Query Parallel Processing</b>
</p>
<p>
<pre>
CHGQRYA DEGREE(*MAX)
</pre>
</p>
<p>This command specifies that the query optimizer can assume that all active memory in the pool can be used to process a query, database file keyed access path build or rebuild, or database file I/O keyed access path maintenance and can choose to use any number of tasks for either I/O or SMP parallel processing to process a query, database file keyed access path build or rebuild, or database file I/O keyed access path maintenance. SMP parallel processing will only be used if the system feature DB2 Symmetric Multiprocessing is installed.
</p>
<p><b>Example 5: Controlling Query Number of Tasks</b>
</p>
<p>
<pre>
CHGQRYA DEGREE(*NBRTASKS 12)
</pre>
</p>
<p>This command specifies that the 12 tasks are to be used when the query optimizer chooses to use SMP parallel processing to process a query, database file keyed access path build or rebuild, or database file I/O keyed access path maintenance. I/O parallelism will also be allowed. SMP parallel processing will only be used if the system feature DB2 Symmetric Multiprocessing is installed.
</p>
<p><b>Example 6: Controlling Query Parallel Processing</b>
</p>
<p>
<pre>
CHGQRYA DEGREE(*SYSVAL)
</pre>
</p>
<p>This command specifies that the query, database file keyed access path build or rebuild, or database file I/O keyed access path maintenance, should be optimized with the current value of system value QQRYDEGREE when the query, database file keyed access path build or rebuild, or database file I/O keyed access path maintenance is run.
</p>
<p><b>Example 7: Disabling Asynchronous Job Usage for Distributed File Processing</b>
</p>
<p>
<pre>
CHGQRYA ASYNCJ(*LOCAL)
</pre>
</p>
<p>This command prevents asynchronous jobs from being used for queries involving distributed files.
</p>
<p><b>Example 8: Disabling Asynchronous Job Usage</b>
</p>
<p>
<pre>
CHGQRYA ASYNCJ(*NONE)
</pre>
</p>
<p>This command prevents asynchronous jobs from being used for any queries. In addition, for queries involving distributed files, communication to remote systems is done in a synchronous fashion.
</p>
<p><b>Example 9: Specifies Query Options File Library</b>
</p>
<p>
<pre>
CHGQRYA QRYOPTLIB(QUSRSYS)
</pre>
</p>
<p>This command specifies that library QUSRSYS is to be searched for the existence of the query options file (QAQQINI).
</p>
<p><b>Note:</b> Use this command in addition to STRDBG UPDPROD(*YES) and all optimizer debug messages (local and remote) will show up in this job's job log.
</p>
<p><b>Example 10: Specifies Query Options File Library for a Different Job</b>
</p>
<p>
<pre>
CHGQRYA QRYOPTLIB(LIB41) JOB(134543/QPGMR/DSP01)
</pre>
</p>
<p>This command specifies that library LIB41 is to be searched for the existence of the query options file (QAQQINI) for job number 134543. The job name is DSP01 and was started by the user named QPGMR. This library may exist in more than one independent ASP (auxiliary storage pool); the library in the namespace of the originator's job will always be used.
</p>
<p><b>Example 11: Changing the Query Resource Limit</b>
</p>
<p>
<pre>
CHGQRYA QRYSTGLMT(200)
</pre>
</p>
<p>This command changes the query temporary storage limit to 200 megabytes.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="CHGQRYA.ERROR.MESSAGES">Error messages</a> </h3>
<p><b><u>*ESCAPE Messages</u></b>
</p>
<dl>
<dt><b>CPF1321</b></dt>
<dd>Job &amp;1 user &amp;2 job number &amp;3 not found.
</dd>
<dt><b>CPF436E</b></dt>
<dd>Job &amp;1 user &amp;2 job number &amp;3 is not active.
</dd>
<dt><b>CPF9810</b></dt>
<dd>Library &amp;1 not found.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#CHGQRYA.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>