ibm-information-center/dist/eclipse/plugins/i5OS.ic.dbp_5.4.0.1/rbafoex11.htm

257 lines
18 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Example 11: Select records using the Open Query File (OPNQRYF) command" />
<meta name="abstract" content="This example shows the use of sort sequence and language identifier when you run the Open Query File (OPNQRYF) command to select records." />
<meta name="description" content="This example shows the use of sort sequence and language identifier when you run the Open Query File (OPNQRYF) command to select records." />
<meta name="DC.Relation" scheme="URI" content="rbafodynsrsex.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbafoex11" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Example 11: Select records using the Open Query File (OPNQRYF) command</title>
</head>
<body id="rbafoex11"><a name="rbafoex11"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example 11: Select records using the Open Query File (OPNQRYF) command</h1>
<div><p>This example shows the use of sort sequence and language identifier
when you run the Open Query File (OPNQRYF) command to select records.</p>
<div class="section"><p>To see how to use a sort sequence, run the examples in this topic
against the STAFF file shown in <a href="#rbafoex11__rbafostafff">Table 1</a>. </p>
</div>
<div class="tablenoborder"><a name="rbafoex11__rbafostafff"><!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="rbafoex11__rbafostafff" width="100%" frame="border" border="1" rules="rows"><caption>Table 1. The STAFF file</caption><thead align="left"><tr><th align="center" valign="bottom" width="14.25925925925926%" id="d0e34">ID</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e36">NAME</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e38">DEPT</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e40">JOB</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e42">YEARS</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e44">SALARY</th>
<th align="center" valign="bottom" width="14.444444444444443%" id="d0e46">COMM</th>
</tr>
</thead>
<tbody><tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">10</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">Sanders</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">20</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">Mgr</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">7</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">18357.50</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">0</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">20</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">Pernal</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">20</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">Sales</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">8</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">18171.25</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">612.45</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">30</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">Merenghi</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">38</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">MGR</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">5</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">17506.75</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">0</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">40</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">OBrien</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">38</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">Sales</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">6</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">18006.00</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">846.55</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">50</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">Hanes</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">15</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">Mgr</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">10</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">20659.80</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">0</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">60</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">Quigley</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">38</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">SALES</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">00</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">16808.30</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">650.25</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">70</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">Rothman</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">15</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">Sales</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">7</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">16502.83</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">1152.00</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">80</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">James</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">20</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">Clerk</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">0</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">13504.60</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">128.20</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">90</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">Koonitz</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">42</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">sales</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">6</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">18001.75</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">1386.70</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e34 ">100</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e36 ">Plotz</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e38 ">42</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e40 ">mgr</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e42 ">6</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e44 ">18352.80</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e46 ">0</td>
</tr>
</tbody>
</table>
</div>
<div class="section"><div class="p">In the examples, the results are shown for a particular statement
using each of the following sort sequences: <ul><li>*HEX sort sequence.</li>
<li>Shared-weight sort sequence for language identifier ENU.</li>
<li>Unique-weight sort sequence for language identifier ENU.</li>
</ul>
<div class="note"><span class="notetitle">Note:</span> ENU is chosen as a language identifier by specifying either SRTSEQ(*LANGIDUNQ)
or SRTSEQ(*LANGIDSHR), and LANGID(ENU) in the OPNQRYF command.</div>
</div>
</div>
<div class="section"><div class="p">The following command selects records with the value <samp class="codeph">MGR</samp> in
the JOB field: <pre>OPNQRYF FILE(STAFF) QRYSLT('JOB *EQ "MGR"')</pre>
<a href="#rbafoex11__rbafostfhex">Table 2</a> shows the record selection with the
*HEX sort sequence. The records that match the record selection criteria for
the JOB field are selected exactly as specified in the QRYSLT statement; only
the uppercase <samp class="codeph">MGR</samp> is selected.</div>
</div>
<div class="tablenoborder"><a name="rbafoex11__rbafostfhex"><!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="rbafoex11__rbafostfhex" width="100%" frame="border" border="1" rules="rows"><caption>Table 2. Use the *HEX sort
sequence. OPNQRYF FILE(STAFF) QRYSLT('JOB *EQ "MGR"') SRTSEQ(*HEX)</caption><thead align="left"><tr><th align="center" valign="bottom" width="14.25925925925926%" id="d0e241">ID</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e243">NAME</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e245">DEPT</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e247">JOB</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e249">YEARS</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e251">SALARY</th>
<th align="center" valign="bottom" width="14.444444444444443%" id="d0e253">COMM</th>
</tr>
</thead>
<tbody><tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e241 ">30</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e243 ">Merenghi</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e245 ">38</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e247 ">MGR</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e249 ">5</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e251 ">17506.75</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e253 ">0</td>
</tr>
</tbody>
</table>
</div>
<div class="section"><p><a href="#rbafoex11__rbafostfshr">Table 3</a> shows the record selection
with the shared-weight sort sequence. The records that match the record selection
criteria for the JOB field are selected by treating uppercase and lowercase
letters the same. With this sort sequence, <samp class="codeph">mgr</samp>, <samp class="codeph">Mgr</samp>,
and <samp class="codeph">MGR</samp> values are selected.</p>
</div>
<div class="tablenoborder"><a name="rbafoex11__rbafostfshr"><!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="rbafoex11__rbafostfshr" width="100%" frame="border" border="1" rules="rows"><caption>Table 3. Use the shared-weight
sort sequence. OPNQRYF FILE(STAFF) QRYSLT('JOB *EQ "MGR"') SRTSEQ(LANGIDSHR)
LANGID(ENU)</caption><thead align="left"><tr><th align="center" valign="bottom" width="14.25925925925926%" id="d0e300">ID</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e302">NAME</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e304">DEPT</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e306">JOB</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e308">YEARS</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e310">SALARY</th>
<th align="center" valign="bottom" width="14.444444444444443%" id="d0e312">COMM</th>
</tr>
</thead>
<tbody><tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e300 ">10</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e302 ">Sanders</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e304 ">20</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e306 ">Mgr</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e308 ">7</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e310 ">18357.50</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e312 ">0</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e300 ">30</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e302 ">Merenghi</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e304 ">38</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e306 ">MGR</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e308 ">5</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e310 ">17506.75</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e312 ">0</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e300 ">50</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e302 ">Hanes</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e304 ">15</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e306 ">Mgr</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e308 ">10</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e310 ">20659.80</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e312 ">0</td>
</tr>
<tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e300 ">100</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e302 ">Plotz</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e304 ">42</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e306 ">mgr</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e308 ">6</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e310 ">18352.80</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e312 ">0</td>
</tr>
</tbody>
</table>
</div>
<div class="section"><p><a href="#rbafoex11__rbafostfunq">Table 4</a> shows the record selection
with the unique-weight sort sequence. The records that match the record selection
criteria for the JOB field are selected by treating uppercase and lowercase
letters as unique. With this sort sequence, the <samp class="codeph">mgr</samp>, <samp class="codeph">Mgr</samp>,
and <samp class="codeph">MGR</samp> values are all different. The <samp class="codeph">MGR</samp> value
is selected.</p>
</div>
<div class="tablenoborder"><a name="rbafoex11__rbafostfunq"><!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="rbafoex11__rbafostfunq" width="100%" frame="border" border="1" rules="rows"><caption>Table 4. Use the unique-weight
sort sequence. OPNQRYF FILE(STAFF) QRYSLT('JOB *EQ "MGR"') SRTSEQ(LANGIDUNQ)
LANGID(ENU)</caption><thead align="left"><tr><th align="center" valign="bottom" width="14.25925925925926%" id="d0e407">ID</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e409">NAME</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e411">DEPT</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e413">JOB</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e415">YEARS</th>
<th align="center" valign="bottom" width="14.25925925925926%" id="d0e417">SALARY</th>
<th align="center" valign="bottom" width="14.444444444444443%" id="d0e419">COMM</th>
</tr>
</thead>
<tbody><tr><td align="center" valign="top" width="14.25925925925926%" headers="d0e407 ">30</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e409 ">Merenghi</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e411 ">38</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e413 ">MGR</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e415 ">5</td>
<td align="center" valign="top" width="14.25925925925926%" headers="d0e417 ">17506.75</td>
<td align="center" valign="top" width="14.444444444444443%" headers="d0e419 ">0</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafodynsrsex.htm" title="These topics provide examples of selecting records using the Open Query File (OPNQRYF) command.">Select records using the Open Query File (OPNQRYF) command</a></div>
</div>
</div>
</body>
</html>