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

119 lines
7.1 KiB
HTML
Raw 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 2: Unique-key processing" />
<meta name="abstract" content="This example shows how to read records using only some of the key fields." />
<meta name="description" content="This example shows how to read records using only some of the key fields." />
<meta name="DC.Relation" scheme="URI" content="rbafoukp.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="rbafoukpex2" />
<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 2: Unique-key processing</title>
</head>
<body id="rbafoukpex2"><a name="rbafoukpex2"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example 2: Unique-key processing</h1>
<div><p>This example shows how to read records using only some of the key
fields.</p>
<div class="section"><p>Assume that you want to process the same file with the sequence: <em>Slsman,
Cust, Date</em>, but you want only one record per <em>Slsman</em> and <em>Cust</em>.
Assume that the records in the file are:</p>
</div>
<table cellpadding="4" cellspacing="0" border="1" class="tableborder"><tr><td>
<table cellpadding="4" cellspacing="0" summary="" width="100%" border="0"><thead align="left"><tr><th align="center" valign="bottom" width="24.937027707808564%" id="d0e32">Slsman</th>
<th align="center" valign="bottom" width="23.173803526448363%" id="d0e34">Cust</th>
<th align="center" valign="bottom" width="25.94458438287154%" id="d0e36">Date</th>
<th align="center" valign="bottom" width="25.94458438287154%" id="d0e38">Record #</th>
</tr>
</thead>
<tbody><tr><td align="center" valign="top" width="24.937027707808564%" headers="d0e32 ">01</td>
<td align="center" valign="top" width="23.173803526448363%" headers="d0e34 ">5000</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e36 ">880109</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e38 ">1</td>
</tr>
<tr><td align="center" valign="top" width="24.937027707808564%" headers="d0e32 ">01</td>
<td align="center" valign="top" width="23.173803526448363%" headers="d0e34 ">5000</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e36 ">880115</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e38 ">2</td>
</tr>
<tr><td align="center" valign="top" width="24.937027707808564%" headers="d0e32 ">01</td>
<td align="center" valign="top" width="23.173803526448363%" headers="d0e34 ">4025</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e36 ">880103</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e38 ">3</td>
</tr>
<tr><td align="center" valign="top" width="24.937027707808564%" headers="d0e32 ">01</td>
<td align="center" valign="top" width="23.173803526448363%" headers="d0e34 ">4025</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e36 ">880101</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e38 ">4</td>
</tr>
<tr><td align="center" valign="top" width="24.937027707808564%" headers="d0e32 ">02</td>
<td align="center" valign="top" width="23.173803526448363%" headers="d0e34 ">3000</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e36 ">880101</td>
<td align="center" valign="top" width="25.94458438287154%" headers="d0e38 ">5</td>
</tr>
</tbody>
</table>
</td></tr></table>
<div class="section"><div class="p">You specify the number of key fields that are unique, starting
with the first key field. <pre>OVRDBF FILE(FILEA) SHARE(*YES)
OPNQRYF FILE(FILEA) KEYFLD(SLSMAN CUST DATE) UNIQUEKEY(2)
CALL PGM(PGMD)
CLOF OPNID(FILEA)
DLTOVR FILE(FILEA)</pre>
</div>
</div>
<div class="section"><p>The following records are retrieved by the program:</p>
</div>
<table cellpadding="4" cellspacing="0" border="1" class="tableborder"><tr><td>
<table cellpadding="4" cellspacing="0" summary="" width="100%" border="0"><thead align="left"><tr><th align="center" valign="bottom" width="24.87437185929648%" id="d0e102">Slsman</th>
<th align="center" valign="bottom" width="22.8643216080402%" id="d0e104">Cust</th>
<th align="center" valign="bottom" width="26.13065326633166%" id="d0e106">Date</th>
<th align="center" valign="bottom" width="26.13065326633166%" id="d0e108">Record #</th>
</tr>
</thead>
<tbody><tr><td align="center" valign="top" width="24.87437185929648%" headers="d0e102 ">01</td>
<td align="center" valign="top" width="22.8643216080402%" headers="d0e104 ">4025</td>
<td align="center" valign="top" width="26.13065326633166%" headers="d0e106 ">880101</td>
<td align="center" valign="top" width="26.13065326633166%" headers="d0e108 ">4</td>
</tr>
<tr><td align="center" valign="top" width="24.87437185929648%" headers="d0e102 ">01</td>
<td align="center" valign="top" width="22.8643216080402%" headers="d0e104 ">5000</td>
<td align="center" valign="top" width="26.13065326633166%" headers="d0e106 ">880109</td>
<td align="center" valign="top" width="26.13065326633166%" headers="d0e108 ">1</td>
</tr>
<tr><td align="center" valign="top" width="24.87437185929648%" headers="d0e102 ">02</td>
<td align="center" valign="top" width="22.8643216080402%" headers="d0e104 ">3000</td>
<td align="center" valign="top" width="26.13065326633166%" headers="d0e106 ">880101</td>
<td align="center" valign="top" width="26.13065326633166%" headers="d0e108 ">5</td>
</tr>
</tbody>
</table>
</td></tr></table>
<div class="section"> <div class="note"><span class="notetitle">Note:</span> Null values are treated as equal, so only the first null value
would be returned.</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafoukp.htm" title="Unique-key processing allows you to process only the first record of a group. The group is defined by one or more records with the same set of key values. Processing the first record implies that the records you receive will have unique keys.">Unique-key processing</a></div>
</div>
</div>
</body>
</html>