194 lines
13 KiB
HTML
194 lines
13 KiB
HTML
<?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="concept" />
|
|
<meta name="DC.Title" content="Select and omit records using logical files" />
|
|
<meta name="abstract" content="The system can select and omit records when using a logical file. This can help you exclude records in a file for processing convenience or for security." />
|
|
<meta name="description" content="The system can select and omit records when using a logical file. This can help you exclude records in a file for processing convenience or for security." />
|
|
<meta name="DC.subject" content="selecting, record, using logical files, omitting records using logical files, logical file, selecting records, omitting records, keyword, DDS, REFACCPTH (Reference Access Path Definition)" />
|
|
<meta name="keywords" content="selecting, record, using logical files, omitting records using logical files, logical file, selecting records, omitting records, keyword, DDS, REFACCPTH (Reference Access Path Definition)" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafodaplf.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafoapso.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafoapdyn.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafoapopn.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../dds/kickoff.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="rbafosorec" />
|
|
<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>Select and omit records using logical files</title>
|
|
</head>
|
|
<body id="rbafosorec"><a name="rbafosorec"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Select and omit records using logical files</h1>
|
|
<div><p>The system can select and omit records when using a logical file.
|
|
This can help you exclude records in a file for processing convenience or
|
|
for security.</p>
|
|
<p>The process of selecting and omitting records is based on comparisons identified
|
|
in position 17 of the DDS form for the logical file, and is similar to a series
|
|
of comparisons coded in a high-level language program. For example, in a logical
|
|
file that contains order detail records, you can specify that the only records
|
|
you want to use are those in which the quantity ordered is greater than the
|
|
quantity shipped. All other records are omitted from the access path. The
|
|
omitted records remain in the physical file but are not retrieved for the
|
|
logical file. If you are adding records to the physical file, all records
|
|
are added, but only selected records that match the select/omit criteria can
|
|
be retrieved using the select/omit access path.</p>
|
|
<div class="p">In DDS, to specify select or omit, you specify an S (select) or O (omit)
|
|
in position 17 of the DDS form. You then name the field (in positions
|
|
19 through 28) that will be used in the selection or omission process. In
|
|
positions 45 through 80 you specify the comparison. <div class="note"><span class="notetitle">Note:</span> Select/omit specifications
|
|
appear after key specifications (if keys are specified).</div>
|
|
</div>
|
|
<div class="p">Records can be selected and omitted by several
|
|
types of comparisons: <ul><li>VALUES. The contents of the field are compared to a list of not more than
|
|
100 values. If a match is found, the record is selected or omitted. In the
|
|
following example, a record is selected if one of the values specified in
|
|
the VALUES keyword is found in the <em>Itmnbr</em> field. <pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
|
A S ITMNBR VALUES(301542 306902 382101 422109 +
|
|
A 431652 486592 502356 556608 590307)
|
|
A</pre>
|
|
</li>
|
|
<li>RANGE. The contents of the field are compared
|
|
to lower and upper limits. If the contents are greater than or equal to the
|
|
lower limit and less than or equal to the upper limit, the record is selected
|
|
or omitted. In the following example, all records with a range 301000 through
|
|
599999 in the <em>Itmnbr</em> field are selected.<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
|
A S ITMNBR RANGE(301000 599999)
|
|
A</pre>
|
|
</li>
|
|
<li>CMP.
|
|
The contents of a field are compared to a value or the contents of another
|
|
field. Valid comparison codes are EQ, NE, LT, NL, GT, NG, LE, and GE. If the
|
|
comparison is met, the record is selected or omitted. In the following example,
|
|
a record is selected if its <em>Itmnbr</em> field is less than or equal to 599999:</li>
|
|
</ul>
|
|
</div>
|
|
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
|
A S ITMNBR CMP(LE 599999)
|
|
A</pre>
|
|
<p>The value for a numeric field for which the CMP, VALUES, or RANGE keyword
|
|
is specified is aligned based on the decimal positions specified for the field
|
|
and filled with zeros where necessary. If decimal positions were not specified
|
|
for the field, the decimal point is placed to the right of the farthest right
|
|
digit in the value. For example, for a numeric field with length 5 and decimal
|
|
position 2, the value 1.2 is interpreted as 001.20 and the value 100 is interpreted
|
|
as 100.00.</p>
|
|
<p>The status of a record is determined by evaluating select/omit statements
|
|
in the sequence you specify them. If a record qualifies for selection or omission,
|
|
subsequent statements are ignored.</p>
|
|
<p>Normally the select and omit comparisons are treated independently from
|
|
one another; the comparisons are ORed together. That is, if the select or
|
|
omit comparison is met, the record is either selected or omitted. If the condition
|
|
is not met, the system proceeds to the next comparison. To connect comparisons
|
|
together, you leave a space in position 17 of the DDS form. Then, all the
|
|
comparisons that were connected in this fashion must be met before the record
|
|
is selected or omitted. That is, the comparisons are ANDed together.</p>
|
|
<p>The fewer comparisons, the more efficient the task is. So, when you have
|
|
several select/omit comparisons, try to specify the one that selects or omits
|
|
the most records first.</p>
|
|
<p>The following examples show ways to code select/omit functions. In these
|
|
examples, few records exist for which the <em>Rep</em> field is JSMITH. The
|
|
examples show how to use DDS to select all the records before 1988 for a sales
|
|
representative named JSMITH in the state of New York. All give the same results
|
|
with different efficiency. <strong>3</strong> shows the most efficient way.</p>
|
|
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
|
A S ST CMP(EQ 'NY') <strong>1</strong>
|
|
A REP CMP(EQ 'JSMITH')
|
|
A YEAR CMP(LT 88)
|
|
A
|
|
|
|
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
|
A O YEAR CMP(GE 88) <strong>2</strong>
|
|
A S ST CMP(EQ 'NY')
|
|
A REP CMP(EQ 'JSMITH')
|
|
A
|
|
|
|
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
|
A O REP CMP(NE 'JSMITH') <strong>3</strong>
|
|
A O ST CMP(NE 'NY')
|
|
A S YEAR CMP(LT 88)
|
|
A</pre>
|
|
<dl><dt class="dlterm">1</dt>
|
|
<dd>All records must be compared with all of the select fields <em>St</em>, <em>Rep</em>,
|
|
and <em>Year</em> before they can be selected or omitted.</dd>
|
|
<dt class="dlterm">2</dt>
|
|
<dd>All records are compared with the <em>Year</em> field. Then, the records
|
|
before 1988 must be compared with the <em>St</em> and <em>Rep</em> fields.</dd>
|
|
<dt class="dlterm">3</dt>
|
|
<dd>All records are compared with the <em>Rep</em> field. Then, only the few
|
|
for JSMITH are compared with the <em>St</em> field. Then, the few records that
|
|
are left are compared to the <em>Year</em> field.</dd>
|
|
</dl>
|
|
<div class="p">As another example, assume that you want to select the following items: <ul><li>All records for departments other than Department 12.</li>
|
|
<li>Only those records for Department 12 that contain an item number 112505,
|
|
428707, or 480100. No other records for Department 12 are to be selected.</li>
|
|
</ul>
|
|
</div>
|
|
<p>If you create the preceding example with a sort sequence table, the select/omit
|
|
fields are translated according to the sort table before the comparison. For
|
|
example, with a sort sequence table using shared weightings for uppercase
|
|
and lowercase, <samp class="codeph">NY</samp> and <samp class="codeph">ny</samp> are equal. </p>
|
|
<p>The following diagram shows the logic included in this example:</p>
|
|
<br /><img src="rbafo504.gif" alt="Example of a record" /><br /><p>This example is coded as follows using the DDS select and omit functions:</p>
|
|
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
|
A S DPTNBR CMP(NE 12)
|
|
A S ITMNBR VALUES(112505 428707 480100)
|
|
A</pre>
|
|
<p>It is possible to have an access path with select/omit values and process
|
|
the file in arrival sequence. For example, a high-level language program can
|
|
specify that the keyed access path is to be ignored. In this case, every record
|
|
is read from the file in arrival sequence, but only those records meeting
|
|
the select/omit values specified in the file are returned to the high-level
|
|
language program.</p>
|
|
<p>A logical file with key fields and select/omit values specified can be
|
|
processed in arrival sequence or using relative record numbers randomly. Records
|
|
omitted by the select/omit values are not processed. That is, if an omitted
|
|
record is requested by relative record number, the record is not returned
|
|
to the high-level language program.</p>
|
|
<div class="p">The system does not ensure that any additions or changes through a logical
|
|
file will allow the record to be accessed again in the same logical file.
|
|
For example, if the selection values of the logical file specifies only records
|
|
with an A in <em>Fld1</em> and the program updates the record with a B in <em>Fld1</em>,
|
|
the program cannot retrieve the record again using this logical file. <div class="note"><span class="notetitle">Note:</span> You
|
|
cannot select or omit based on the values of a floating-point field.</div>
|
|
</div>
|
|
<p>The two kinds of select/omit operations are: access path select/omit and
|
|
dynamic select/omit. The default is access path select/omit. The select/omit
|
|
specifications themselves are the same in each kind, but the system actually
|
|
does the work of selecting and omitting records at different times. </p>
|
|
<p>You can also use the Open Query File (OPNQRYF) command to select or omit
|
|
records. </p>
|
|
</div>
|
|
<div>
|
|
<ul class="ullinks">
|
|
<li class="ulchildlink"><strong><a href="rbafoapso.htm">Access path select/omit</a></strong><br />
|
|
With the access path select/omit operation, the access path only contains keys that meet the select/omit values specified for the logical file.</li>
|
|
<li class="ulchildlink"><strong><a href="rbafoapdyn.htm">Dynamic select/omit</a></strong><br />
|
|
With the dynamic select/omit operation, when a program reads records from the file, the system only returns those records that meet the select/omit values. That is, the actual select/omit processing is done when records are read by a program, rather than when the records are added or changed.</li>
|
|
<li class="ulchildlink"><strong><a href="rbafoapopn.htm">Use the Open Query File (OPNQRYF) command to select and omit records</a></strong><br />
|
|
Another method of selecting records is using the QRYSLT parameter on the Open Query File (OPNQRYF) command. The open data path created by the OPNQRYF command is like a temporary logical file; that is, it is automatically deleted when it is closed. A logical file, however, remains in existence until you specifically delete it.</li>
|
|
</ul>
|
|
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafodaplf.htm" title="Use one of the ways to describe access paths for logical files.">Describe access paths for logical files</a></div>
|
|
</div>
|
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
|
<div><a href="../dds/kickoff.htm">DDS concepts</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |