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

672 lines
29 KiB
HTML

<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Run Query (RUNQRY)</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="RUNQRY.Top_Of_Page"></a>
<h2>Run Query (RUNQRY)</h2>
<table width="100%">
<tr>
<td valign="top" align="left"><b>Where allowed to run: </b>All environments (*ALL)<br>
<b>Threadsafe: </b>No
</td>
<td valign="top" align="right">
<a href="#RUNQRY.PARAMETERS.TABLE">Parameters</a><br>
<a href="#RUNQRY.COMMAND.EXAMPLES">Examples</a><br>
<a href="#RUNQRY.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="RUNQRY"></a>
<p>The Run Query (RUNQRY) command runs an existing query or a default query if only a file name is specified for this command. The query gets information from the system database and produces a report of that information. The report is created in either detailed or summary form. The definition of the query can be printed when output to a printer or database file is specified. The output is shown, printed, or stored in a database file. The command is used in three ways: to run an existing query (one that has already been created), to run an existing query with some of its values changed by values specified on this command, or to run a default query based only on the defaults and values specified in this command.
</p>
<ul>
<li>To run an existing query without changing the file or files to query, use the QRY parameter (without the QRYFILE parameter) to specify the name of the query.
</li>
<li>To run a changed version of an existing query, use the QRY parameter and the appropriate parameters to change the definition as desired. The parameter values specified on this command override the corresponding values in the existing query definition, but only when the command is processing. For example, use the QRYFILE parameter to indicate a different file or list of files to use in the query.
</li>
<li>To query a file without a previously defined query definition, use the QRYFILE parameter to specify which file to query. Only one file name can be specified for a default query.
</li>
</ul>
<p>If you specify both the QRY and QRYFILE parameters, the files specified in the QRYFILE parameter override the file names specified in the query. Therefore, if multiple files (and members) are defined in the query definition and you want to change one or two of them, specify *SAME for the file selections that do not change, and specify the values for the files to override.
</p>
<p><b>Notes:</b>
</p>
<ol>
<li>When a changed version of an existing query is run, the changes specified on the RUNQRY command do <b>not</b> change any of the values in the query definition itself; they affect only the results of the report being run.
</li>
<li>If an existing query (identified on the QRY parameter) is used, *RUNOPT is the default value for any unspecified parameters; that is , the same value specified (or assumed) in the definition of the query is used as the default. If this is a default query, the default value is not *RUNOPT, but is the next predefined value listed in the syntax diagram.
</li>
</ol>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="RUNQRY.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="3"><a href="#RUNQRY.QRY"><b>QRY</b></a></td>
<td valign="top">Query</td>
<td valign="top">Single values: *NONE<br>Other values: <i>Qualified object name</i></td>
<td valign="top" rowspan="3">Optional, Positional 1</td>
</tr>
<tr>
<td valign="top">Qualifier 1: Query</td>
<td valign="top"><i>Name</i></td>
</tr><tr>
<td valign="top">Qualifier 2: Library</td>
<td valign="top"><i>Name</i>, <b><u>*LIBL</u></b>, *CURLIB</td>
</tr><tr>
<td valign="top" rowspan="5"><a href="#RUNQRY.QRYFILE"><b>QRYFILE</b></a></td>
<td valign="top">Query file</td>
<td valign="top">Values (up to 32 repetitions): <i>Element list</i></td>
<td valign="top" rowspan="5">Optional, Positional 2</td>
</tr>
<tr>
<td valign="top">Element 1: File</td>
<td valign="top">
<i>Qualified object name</i></td>
</tr>
<tr>
<td valign="top" style="padding-left:10pt">Qualifier 1: File</td>
<td valign="top"><i>Name</i>, *SAME</td>
</tr><tr>
<td valign="top" style="padding-left:10pt">Qualifier 2: Library</td>
<td valign="top"><i>Name</i>, *RUNOPT, <b><u>*LIBL</u></b>, *CURLIB</td>
</tr><tr>
<td valign="top">Element 2: Member</td>
<td valign="top">
<i>Name</i>, *RUNOPT, <b><u>*FIRST</u></b>, *LAST, *ALL</td>
</tr>
<tr>
<td valign="top"><a href="#RUNQRY.OUTTYPE"><b>OUTTYPE</b></a></td>
<td valign="top">Report output type</td>
<td valign="top"><b><u>*RUNOPT</u></b>, *DISPLAY, *PRINTER, *OUTFILE</td>
<td valign="top">Optional, Positional 3</td>
</tr>
<tr>
<td valign="top"><a href="#RUNQRY.OUTFORM"><b>OUTFORM</b></a></td>
<td valign="top">Output form</td>
<td valign="top"><b><u>*RUNOPT</u></b>, *DETAIL, *SUMMARY</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNQRY.RCDSLT"><b>RCDSLT</b></a></td>
<td valign="top">Record selection</td>
<td valign="top"><b><u>*NO</u></b>, *YES</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNQRY.PRTDFN"><b>PRTDFN</b></a></td>
<td valign="top">Print query definition</td>
<td valign="top"><b><u>*RUNOPT</u></b>, *NO, *YES</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNQRY.PRTDEV"><b>PRTDEV</b></a></td>
<td valign="top">Print device</td>
<td valign="top"><i>Name</i>, <b><u>*RUNOPT</u></b>, *PRINT</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#RUNQRY.FORMSIZE"><b>FORMSIZE</b></a></td>
<td valign="top">Form size</td>
<td valign="top"><i>Element list</i></td>
<td valign="top" rowspan="3">Optional</td>
</tr>
<tr>
<td valign="top">Element 1: Form length</td>
<td valign="top">
1-255, <b><u>*RUNOPT</u></b></td>
</tr>
<tr>
<td valign="top">Element 2: Form width</td>
<td valign="top">
1-378, <b><u>*RUNOPT</u></b></td>
</tr>
<tr>
<td valign="top"><a href="#RUNQRY.FORMTYPE"><b>FORMTYPE</b></a></td>
<td valign="top">Form type</td>
<td valign="top"><i>Character value</i>, <b><u>*RUNOPT</u></b>, *STD</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNQRY.COPIES"><b>COPIES</b></a></td>
<td valign="top">Copies</td>
<td valign="top">1-255, <b><u>*RUNOPT</u></b></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNQRY.LINESPACE"><b>LINESPACE</b></a></td>
<td valign="top">Line spacing</td>
<td valign="top"><b><u>*RUNOPT</u></b>, 1, 2, 3</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top" rowspan="6"><a href="#RUNQRY.OUTFILE"><b>OUTFILE</b></a></td>
<td valign="top">Output file</td>
<td valign="top"><i>Element list</i></td>
<td valign="top" rowspan="6">Optional</td>
</tr>
<tr>
<td valign="top">Element 1: File</td>
<td valign="top">
<i>Qualified object name</i></td>
</tr>
<tr>
<td valign="top" style="padding-left:10pt">Qualifier 1: File</td>
<td valign="top"><i>Name</i>, <b><u>*RUNOPT</u></b></td>
</tr><tr>
<td valign="top" style="padding-left:10pt">Qualifier 2: Library</td>
<td valign="top"><i>Name</i>, <b><u>*RUNOPT</u></b>, *CURLIB</td>
</tr><tr>
<td valign="top">Element 2: Member</td>
<td valign="top">
<i>Name</i>, *RUNOPT, <b><u>*FIRST</u></b>, *LAST, *ALL</td>
</tr>
<tr>
<td valign="top">Element 3: Option</td>
<td valign="top">
<b><u>*RUNOPT</u></b>, *NEWFILE, *RPLFILE, *NEWMBR, *RPLMBR, *ADDMBR</td>
</tr>
<tr>
<td valign="top"><a href="#RUNQRY.AUT"><b>AUT</b></a></td>
<td valign="top">Authority</td>
<td valign="top"><i>Name</i>, <b><u>*RUNOPT</u></b>, *LIBCRTAUT, *USE, *CHANGE, *ALL, *EXCLUDE</td>
<td valign="top">Optional</td>
</tr>
</table>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="RUNQRY.QRY"></a>
<h3>Query (QRY Parameter)</h3>
<p>Specifies the name of an existing query to be run. If QRY is not specified, QRYFILE must be specified.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>No existing query definition is used. Instead, a default query (or quick query) is used to get information from the file specified on the QRYFILE parameter.
</dd>
<dt><b><i>query-name</i></b></dt>
<dd>Specify the name of the query to run.
<p>If no value is specified, the file or files that were specified when the query was defined are the files to be queried.
</p>
</dd>
</dl>
<p>The name of the query can be qualified by one of the following library values:
</p>
<dl>
<dt><b><u>*LIBL</u></b></dt>
<dd>All libraries in the library list for the current thread are searched until the first match is found.
</dd>
</dl>
<dl>
<dt><b><u>*CURLIB</u></b></dt>
<dd>The current library for the job is used to locate the specified query definition. If no library is specified as the current library for the job, the QGPL library is used.
</dd>
<dt><b><i>library-name</i></b></dt>
<dd>Specify the library where the query is located.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.QRYFILE"></a>
<h3>Query file (QRYFILE Parameter)</h3>
<p>Specifies the database file or files to be queried for information. If the QRY parameter is specified, as many as 32 files can be specified on this parameter by using the file names and/or using the default value *SAME for one or more of the files. If the QRY parameter is not specified, only one file name can be specified on this parameter. If QRYFILE is not specified, QRY must be specified.
</p>
<p>If no value is specified, the file or files that were specified when the query was defined are the files used to run the query.
</p>
<p>You can enter multiple values for this parameter.
</p>
<p>There are two parts to this parameter.
</p>
<p><b>Element 1: Database File Name</b>
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><i>data-base-file-name</i></b></dt>
<dd>Specify the names of one or more database files that contain the data from which the system gets information to produce the output. Up to 32 files can be specified.
</dd>
<dt><b>*SAME</b></dt>
<dd>The list of files remains the same as defined in the query definition.
</dd>
</dl>
<p>The name of a database file can be qualified by one of the following library values:
</p>
<dl>
<dt><b><u>*SAME</u></b></dt>
<dd>The value of the library, file, and member do not change for the file in this position within the list. The values are the same as defined in the query. Any values specified for the library, file, and member are ignored.
</dd>
</dl>
<dl>
<dt><b><u>*LIBL</u></b></dt>
<dd>All libraries in the library list for the current thread are searched until the first match is found.
</dd>
</dl>
<dl>
<dt><b>*CURLIB</b></dt>
<dd>The current library for the job is used to locate the database file. If no library is specified as the current library for the job, QGPL is used.
</dd>
<dt><b>*RUNOPT</b></dt>
<dd>The library specified for the file selection is used.
</dd>
<dt><b><i>library-name</i></b></dt>
<dd>Specify the library where the database file is located.
</dd>
</dl>
<p><b>Element 2: Database File Member</b>
</p>
<p>The possible values for member name are:
</p>
<dl>
<dt><b><i>member-name</i></b></dt>
<dd>Specify the name of the file member to be queried.
</dd>
<dt><b>*RUNOPT</b></dt>
<dd>The member specified for this file selection is used.
</dd>
<dt><b><u>*FIRST</u></b></dt>
<dd>The first member in the file is the member to be queried.
</dd>
<dt><b>*LAST</b></dt>
<dd>The last member in the file is the member to be queried.
</dd>
<dt><b>*ALL</b></dt>
<dd>The input file is a partitioned table, where all of the members in the file are to be queried.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.OUTTYPE"></a>
<h3>Report output type (OUTTYPE Parameter)</h3>
<p>Specifies where the report or output produced by the query is sent. If a value is not specified in the query, and is not entered on the command, or if a query name is not specified, *DISPLAY is assumed.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is being used, the type of output specified in the query definition is the type of output produced when this query is run.
</dd>
<dt><b>*DISPLAY</b></dt>
<dd>The output produced by the query is sent to the display station that runs the command. If run in batch, the output is sent to the printer instead of the display.
</dd>
<dt><b>*PRINTER</b></dt>
<dd>The output produced by the query is printed.
</dd>
<dt><b>*OUTFILE</b></dt>
<dd>The output is directed to the database file specified on the OUTFILE parameter.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.OUTFORM"></a>
<h3>Output form (OUTFORM Parameter)</h3>
<p>Specifies the form of output produced by the query. If no value was specified in the query and no value was entered on the command, or if a query name is not specified, *DETAIL is assumed.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is used, the output form specified in the query definition is used when this query is run.
</dd>
<dt><b>*DETAIL</b></dt>
<dd>The output form produced by the query is a report containing detail records and summary records if any exist.
</dd>
<dt><b>*SUMMARY</b></dt>
<dd>The output form produced by the query is a report containing summary records only.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.RCDSLT"></a>
<h3>Record selection (RCDSLT Parameter)</h3>
<p>Specifies whether or not the query is run with a run time selection test.
</p>
<p>
<b>Note: </b>The Query for iSeries licensed program must be installed and the query must be run interactively to specify *YES.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*NO</u></b></dt>
<dd>The query is run without showing the record selection display in Query.
</dd>
<dt><b>*YES</b></dt>
<dd>Record selection definition is allowed for this run only. A display is shown on which you can change the record selection tests defined in the query or specify record selection tests if a query name was not specified.
<p>
<b>Note: </b>For output to display, query can be run repeatedly.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.PRTDFN"></a>
<h3>Print query definition (PRTDFN Parameter)</h3>
<p>Specifies whether or not the query definition is printed with the report when the query is run. The definition can be printed when the output of the query is printed or is stored in a database file, as determined by the OUTTYPE parameter. If a value is not specified in the query, or in this parameter, or if a query name is not specified, the value *NO is assumed.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is being used when the query is run, the print option specified in the query definition is used.
</dd>
<dt><b>*NO</b></dt>
<dd>The query definition is not printed when the query is run.
</dd>
<dt><b>*YES</b></dt>
<dd>The query definition is printed in the report. *YES cannot be specified if OUTTYPE(*DISPLAY) is specified or assumed.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.PRTDEV"></a>
<h3>Print device (PRTDEV Parameter)</h3>
<p>Specifies the printer device on which the report is printed. If no value is specified, the printer that was specified when the query was defined is assumed. If no printer is specified in the query or in this parameter, or if a query name is not specified, the value *PRINT is assumed.
</p>
<p>
<b>Note: </b>If an override is in effect for the printer file QPQUPRFIL, this parameter uses the value specified by the override.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is being used, the printer specified in the query definition is used to print the output when this query is run.
</dd>
<dt><b>*PRINT</b></dt>
<dd>The default printer, as defined by QPQUPRFIL, is used to print the output when this query is run.
</dd>
<dt><b><i>printer-device-name</i></b></dt>
<dd>Specify the name of the printer that is used to print the output when this query is run.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.FORMSIZE"></a>
<h3>Form size (FORMSIZE Parameter)</h3>
<p>Specifies the length and the width of the forms on which the report is printed. If a form width greater than 132 is specified, Query will open the file with CPI(15) and FONT(*CPI). If no value is specified in the query or in this parameter, or if a query name is not specified, 132 is the assumed form width, and the value from the file QPQUPRFIL is the assumed form length.
</p>
<p>
<b>Note: </b>If an override is in effect for the printer file QPQUPRFIL, this parameter uses the value specified by the override.
</p>
<p>There are two parts to this parameter.
</p>
<p><b>Element 1: Form Length</b>
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is being used when the query is run, the form size specified in the query definition is used. If the form size specified in the query definition is blank, the value from QPQUPRFIL is assumed.
</dd>
<dt><b><i>form-length</i></b></dt>
<dd>Specify the form length used when this query is run. Valid values range from 1 through 255.
</dd>
</dl>
<p><b>Element 2: Form Width</b>
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is being used when the query is run, the form size specified in the query definition is used. If the form size specified in the query definition is blank, the value from QPQUPRFIL is assumed.
</dd>
<dt><b><i>form-width</i></b></dt>
<dd>Specify the form width used when this query is run. Valid values range from 1 through 378.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.FORMTYPE"></a>
<h3>Form type (FORMTYPE Parameter)</h3>
<p>Specifies the type of form on which the output is printed. The identifiers used to indicate the type of forms are user-defined and can be a maximum of 10 characters in length.
</p>
<p>
<b>Note: </b>If a value is not specified in the query or on this parameter, or if a query name is not specified, the value in QPQUPRFIL is assumed. If an override is in effect for the printer file QPQUPRFIL, this parameter uses the value specified by the override.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is being used, the form type specified in the query definition is used when this query is run.
</dd>
<dt><b><i>form-type</i></b></dt>
<dd>Specify the form type that is used when this query is run.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.COPIES"></a>
<h3>Copies (COPIES Parameter)</h3>
<p>Specifies the number of copies being printed.
</p>
<p>
<b>Note: </b>If a value is not specified in the query or on this parameter, or if a query name is not specified, 1 is the assumed number of copies. If an override is in effect for the printer file QPQUPRFIL, this parameter uses the value specified by the override.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is being used, the number of copies specified in the query definition is used when this query is run. If the number of copies specified in the query definition is blank, the number of copies from QPQUPRFIL is assumed.
</dd>
<dt><b><i>number-of-copies</i></b></dt>
<dd>Specify the number of copies to print when this query is run. Specify a number ranging from 1 through 255.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.LINESPACE"></a>
<h3>Line spacing (LINESPACE Parameter)</h3>
<p>Specifies the number of blank lines to leave between lines in the report. The numbers range from 1 through 3. If a value was not specified in the query or on this parameter, or if a query name is not specified, 1 is the assumed value.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is being used, the number of lines specified in the query definition is used when this query is run.
</dd>
<dt><b>1</b></dt>
<dd>Indicates that single spacing (no blank lines) is used when the query output is printed.
</dd>
<dt><b>2</b></dt>
<dd>Indicates that double spacing (1 blank line) is used when the query output is printed.
</dd>
<dt><b>3</b></dt>
<dd>Indicates that triple spacing (2 blank lines) is used when the query output is printed.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.OUTFILE"></a>
<h3>Output file (OUTFILE Parameter)</h3>
<p>Specifies the database file (if any) that receives the query output. If no value is specified for this parameter, the library, file, member, and option specified in the query are assumed. If a query is not specified, the file QQRYOUT is created in the default output file library. This library is defined in the query profile or the current library (*CURLIB) if no profile exists. The first member (*FIRST) of this new file is used for the output.
</p>
<p>
<b>Note: </b>If you did not specify a current library, the QGPL library is used.
</p>
<p>If the name specified by the OUTFILE parameter does not exist, the system creates it in the specified library.
</p>
<p>There are three parts to this parameter.
</p>
<p><b>Element 1: Database File Name</b> The possible values are:
</p>
<dl>
<dt><b><i>data-base-file-name</i></b></dt>
<dd>Specify the name of the database file that receives the output of the query.
</dd>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>The database file specified in the query is used to receive the output of the query. The file, library, member, and option do not change. Any values specified for the library, member, and option are ignored.
</dd>
</dl>
<p>The name of the database file can be qualified by one of the following library values:
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If specified in the query definition, the output is directed to the library named in the query definition.
</dd>
<dt><b>*CURLIB</b></dt>
<dd>The current library for the job is used to locate the database file. If no library is specified as the current library for the job, the QGPL library is used.
</dd>
<dt><b><i>library-name</i></b></dt>
<dd>Specify the name of the library to be used.
</dd>
</dl>
<p><b>Element 2: Database File Member</b>
</p>
<p>The possible member values are:
</p>
<dl>
<dt><b><u>*FIRST</u></b></dt>
<dd>The first member in the file is used to receive the query output.
</dd>
<dt><b>*LAST</b></dt>
<dd>The last member in the file is used to receive the query output.
</dd>
<dt><b>*RUNOPT</b></dt>
<dd>The member specified in the query is used to receive the query output.
</dd>
<dt><b>*ALL</b></dt>
<dd>The output file is a partitioned table, where all members in the file are used to receive the query output. When *ALL is specified for the member, the <b>Element 3 Data</b> option can only be set to *RPLMBR or *ADDMBR. The partitoned table must already exist when the query is run.
</dd>
<dt><b><i>member-name</i></b></dt>
<dd>The named file member is used to receive the query output.
</dd>
</dl>
<p><b>Element 3: Adding or Replacing Data</b>
</p>
<p>The last option specifies whether to put the data in a new database file, replace an existing database file, add a new member, replace an existing member, or add data to an existing member. If no value is specified in the query or in this parameter, or if a query name is not specified, the value *NEWFILE is assumed.
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If a query definition is used, the member option specified in the query definition is the type used when this query is run.
</dd>
<dt><b>*NEWFILE</b></dt>
<dd>The output is written to a new database file. This option is not valid when the member name is set to *ALL.
</dd>
<dt><b>*RPLFILE</b></dt>
<dd>The output deletes the old file and creates a new file. This option is not valid when the member name is set to *ALL.
</dd>
<dt><b>*NEWMBR</b></dt>
<dd>The output is added as a new member. This option is not valid when the member name is set to *ALL.
</dd>
<dt><b>*RPLMBR</b></dt>
<dd>The existing member is cleared and the output is then added.
</dd>
<dt><b>*ADDMBR</b></dt>
<dd>The output is added to the end of an existing member.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNQRY.AUT"></a>
<h3>Authority (AUT Parameter)</h3>
<p>Specifies the authority given to users who do not have specific authority to the output file, who are not on an authorization list, and whose user group has no specific authority to the output file. More information on this parameter is in the CL Reference book, Appendix A.
</p>
<p>
<b>Note: </b>The authority is assigned only when the output file is created or replaced.
</p>
<p>The possible values are:
</p>
<dl>
<dt><b><u>*RUNOPT</u></b></dt>
<dd>If specified in the query definition, the authority named in the query definition is used.
</dd>
<dt><b>*LIBCRTAUT</b></dt>
<dd>The public authority for the output file is taken from the value on the CRTAUT parameter of the target library (the library that is to contain the output file). The public authority is determined when the output file is created. If the CRTAUT value for the library changes after the output file is created, the new value does not affect any existing objects.
</dd>
<dt><b>*CHANGE</b></dt>
<dd>You can perform all operations on the output file except those limited to the owner or controlled by object existence authority and object management authority. You can change and perform basic functions on the output file. Change authority provides object operational authority and all data authority.
</dd>
<dt><b>*USE</b></dt>
<dd>You can perform basic operations on the output file, such as running a program or reading a file. You cannot change the output file. *USE authority provides object operational authority, read authority, and execute authority.
</dd>
<dt><b>*ALL</b></dt>
<dd>You perform all operations on the output file except those limited to the owner or controlled by authorization list management authority.
</dd>
<dt><b>*EXCLUDE</b></dt>
<dd>You cannot access the output file.
</dd>
<dt><b><i>authorization-list-name</i></b></dt>
<dd>Specify the name of the authorization list used.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="RUNQRY.COMMAND.EXAMPLES">Examples</a> </h3>
<p><b>Example 1: Printing Summary Records Only</b>
</p>
<p>
<pre>
RUNQRY QRY(LIBX/QRY1) OUTTYPE(*PRINTER)
OUTFORM(*SUMMARY) COPIES(4)
</pre>
</p>
<p>This command runs the query QRY1 located in library LIBX. The report that is produced and printed contains summary records only. Four copies of the report are printed.
</p>
<p><b>Example 2: Running a Default Query</b>
</p>
<p>
<pre>
RUNQRY QRYFILE((LIBX/FILE2 *FIRST))
OUTTYPE(*OUTFILE) OUTFORM(*DETAIL)
RCDSLT(*YES) OUTFILE(LIB2/OUT1 MBR4 *NEWMBR)
</pre>
</p>
<p>This command runs a default query and gets the data from the first member of file FILE2 located in library LIBX. Member MBR4 is created as a new member to file OUT1 in library LIB2. Member MBR4 contains the output from the default query. The record selection display is shown to allow you to specify which records from file FILE2 in library LIBX are written to new member MBR4 in file OUT1 in library LIB2. The output contains detail records only.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="RUNQRY.ERROR.MESSAGES">Error messages</a> </h3>
<p>None
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNQRY.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>