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

89 lines
5.0 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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 9: Select records using the Open Query File (OPNQRYF) command" />
<meta name="abstract" content="This example shows how to specify the complex selection statements when you select records using the Open Query File (OPNQRYF) command." />
<meta name="description" content="This example shows how to specify the complex selection statements when you select records using the Open Query File (OPNQRYF) command." />
<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="rbafodynsrex9" />
<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 9: Select records using the Open Query File (OPNQRYF) command</title>
</head>
<body id="rbafodynsrex9"><a name="rbafodynsrex9"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example 9: Select records using the Open Query File (OPNQRYF) command</h1>
<div><p>This example shows how to specify the complex selection statements
when you select records using the Open Query File (OPNQRYF) command.</p>
<div class="section"><div class="p">Complex selection statements can also be specified. For example,
you can specify: <pre>QRYSLT('DATE *EQ "880101" *AND AMT *GT 5000.00')
QRYSLT('DATE *EQ "880101" *OR AMT *GT 5000.00')</pre>
</div>
</div>
<div class="section"><div class="p">You can also specify: <pre>QRYSLT('CODE *EQ "A" *AND TYPE *EQ "X" *OR CODE *EQ "B")</pre>
</div>
</div>
<div class="section"><div class="p">The rules governing the priority of processing the operators are
described in the Control language (CL) topic. Some of the rules are: <ul><li>The *AND operations are processed first; therefore, the record would be
selected if: <div class="p"> <p>  The <em>Code</em> field = "A"   and    The <em>Type</em> field = "X"<br />
      or<br />
  The <em>Code</em> field = "B"</p>
</div>
</li>
<li>Parentheses can be used to control how the expression is handled, as shown
in this example: <pre>QRYSLT('(CODE *EQ "A" *OR CODE *EQ "B") *AND TYPE *EQ "X" +
*OR CODE *EQ "C"')</pre>
<div class="p"> <p>  The <em>Code</em> field = "A"    and    The <em>Type</em> field= "X"<br />
      or<br />
  The <em>Code</em> field = "B"    and    The <em>Type</em> field = "X"<br />
      or<br />
  The <em>Code</em> field = "C"</p>
</div>
</li>
</ul>
</div>
</div>
<div class="section"><div class="p">You can also use the symbols described in the Control language
(CL) topic, instead of the abbreviated form (for example, you can use = instead
of *EQ), as shown in this example: <pre>QRYSLT('CODE = "A" &amp; TYPE = "X" | AMT &gt; 5000.00')</pre>
</div>
</div>
<div class="section"><div class="p">This command selects all records in which: <p>  The <em>Code</em> field = "A"   and   The <em>Type</em> field = "X"<br />
      or<br />
  The <em>Amt</em> field &gt; 5000.00</p>
</div>
</div>
<div class="section"><div class="p">A complex selection statement can also be written like this:<pre>QRYSLT('CUSNBR = %RANGE("60000" "69999") &amp; TYPE = "B" +
&amp; SALES&gt;0 &amp; ACCRCV / SALES&gt;.3')</pre>
</div>
</div>
<div class="section"><div class="p">This command selects all records in which: <p>    The <em>Cusnbr</em> field is in the range 60000-69999 and<br />
    The <em>Type</em> field = "B" and<br />
    The <em>Sales</em> fields are greater than 0 and<br />
    <em>Accrcv</em> divided by <em>Sales</em> is greater than 30 percent</p>
</div>
</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>