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

167 lines
9.1 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="concept" />
<meta name="DC.Title" content="Arrange key fields using an alternative collating sequence" />
<meta name="abstract" content="Keyed fields defined as character fields can be arranged based either on the sequence for EBCDIC characters or on an alternative collating sequence." />
<meta name="description" content="Keyed fields defined as character fields can be arranged based either on the sequence for EBCDIC characters or on an alternative collating sequence." />
<meta name="DC.subject" content="key field, arranging, changing order, ascending sequence, descending sequence, field, arranging keys, alternative collating sequence, arranging key fields" />
<meta name="keywords" content="key field, arranging, changing order, ascending sequence, descending sequence, field, arranging keys, alternative collating sequence, arranging key fields" />
<meta name="DC.Relation" scheme="URI" content="rbafoksapa.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="rbafoacolsq" />
<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>Arrange key fields using an alternative collating sequence</title>
</head>
<body id="rbafoacolsq"><a name="rbafoacolsq"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Arrange key fields using an alternative collating sequence</h1>
<div><p>Keyed fields defined as character fields can be arranged based
either on the sequence for EBCDIC characters or on an alternative collating
sequence.</p>
<p>Consider the following records.</p>
<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="left" valign="top" id="d0e48">Record</th>
<th align="left" valign="top" id="d0e50">Empname</th>
<th align="left" valign="top" id="d0e52">Deptnbr</th>
<th align="left" valign="top" id="d0e54">Empnbr</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" headers="d0e48 ">1</td>
<td align="left" valign="top" headers="d0e50 ">Jones, Mary</td>
<td align="left" valign="top" headers="d0e52 ">45</td>
<td align="left" valign="top" headers="d0e54 ">23318</td>
</tr>
<tr><td align="left" valign="top" headers="d0e48 ">2</td>
<td align="left" valign="top" headers="d0e50 ">Smith, Ron</td>
<td align="left" valign="top" headers="d0e52 ">45</td>
<td align="left" valign="top" headers="d0e54 ">41321</td>
</tr>
<tr><td align="left" valign="top" headers="d0e48 ">3</td>
<td align="left" valign="top" headers="d0e50 ">JOHNSON, JOHN</td>
<td align="left" valign="top" headers="d0e52 ">53</td>
<td align="left" valign="top" headers="d0e54 ">41322</td>
</tr>
<tr><td align="left" valign="top" headers="d0e48 ">4</td>
<td align="left" valign="top" headers="d0e50 ">Smith, ROBERT</td>
<td align="left" valign="top" headers="d0e52 ">27</td>
<td align="left" valign="top" headers="d0e54 ">56218</td>
</tr>
<tr><td align="left" valign="top" headers="d0e48 ">5</td>
<td align="left" valign="top" headers="d0e50 ">JONES, MARTIN</td>
<td align="left" valign="top" headers="d0e52 ">53</td>
<td align="left" valign="top" headers="d0e54 ">62213</td>
</tr>
</tbody>
</table>
</td></tr></table>
<p>If the <em>Empname</em> is the key field and is a character field, using
the sequence for EBCDIC characters, the records can be arranged as follows.</p>
<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="left" valign="top" id="d0e115">Record</th>
<th align="left" valign="top" id="d0e117">Empname</th>
<th align="left" valign="top" id="d0e119">Deptnbr</th>
<th align="left" valign="top" id="d0e121">Empnbr</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" headers="d0e115 ">1</td>
<td align="left" valign="top" headers="d0e117 ">Jones, Mary</td>
<td align="left" valign="top" headers="d0e119 ">45</td>
<td align="left" valign="top" headers="d0e121 ">23318</td>
</tr>
<tr><td align="left" valign="top" headers="d0e115 ">3</td>
<td align="left" valign="top" headers="d0e117 ">JOHNSON, JOHN</td>
<td align="left" valign="top" headers="d0e119 ">53</td>
<td align="left" valign="top" headers="d0e121 ">41322</td>
</tr>
<tr><td align="left" valign="top" headers="d0e115 ">5</td>
<td align="left" valign="top" headers="d0e117 ">JONES, MARTIN</td>
<td align="left" valign="top" headers="d0e119 ">53</td>
<td align="left" valign="top" headers="d0e121 ">62213</td>
</tr>
<tr><td align="left" valign="top" headers="d0e115 ">2</td>
<td align="left" valign="top" headers="d0e117 ">Smith, Ron</td>
<td align="left" valign="top" headers="d0e119 ">45</td>
<td align="left" valign="top" headers="d0e121 ">41321</td>
</tr>
<tr><td align="left" valign="top" headers="d0e115 ">4</td>
<td align="left" valign="top" headers="d0e117 ">Smith, ROBERT</td>
<td align="left" valign="top" headers="d0e119 ">27</td>
<td align="left" valign="top" headers="d0e121 ">56218</td>
</tr>
</tbody>
</table>
</td></tr></table>
<p>Notice that the EBCDIC sequence causes an unexpected sort order because
the lowercase characters are sorted before uppercase characters. Thus, <samp class="codeph">Smith,
Ron</samp> sorts before <samp class="codeph">Smith, ROBERT</samp>. An alternative collating
sequence can be used to sort the records when the records were entered using
uppercase and lowercase as shown in the following example.</p>
<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="left" valign="top" id="d0e185">Record</th>
<th align="left" valign="top" id="d0e187">Empname</th>
<th align="left" valign="top" id="d0e189">Deptnbr</th>
<th align="left" valign="top" id="d0e191">Empnbr</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" headers="d0e185 ">3</td>
<td align="left" valign="top" headers="d0e187 ">JOHNSON, JOHN</td>
<td align="left" valign="top" headers="d0e189 ">53</td>
<td align="left" valign="top" headers="d0e191 ">41322</td>
</tr>
<tr><td align="left" valign="top" headers="d0e185 ">5</td>
<td align="left" valign="top" headers="d0e187 ">JONES, MARTIN</td>
<td align="left" valign="top" headers="d0e189 ">53</td>
<td align="left" valign="top" headers="d0e191 ">62213</td>
</tr>
<tr><td align="left" valign="top" headers="d0e185 ">1</td>
<td align="left" valign="top" headers="d0e187 ">Jones, Mary</td>
<td align="left" valign="top" headers="d0e189 ">45</td>
<td align="left" valign="top" headers="d0e191 ">23318</td>
</tr>
<tr><td align="left" valign="top" headers="d0e185 ">4</td>
<td align="left" valign="top" headers="d0e187 ">Smith, ROBERT</td>
<td align="left" valign="top" headers="d0e189 ">27</td>
<td align="left" valign="top" headers="d0e191 ">56218</td>
</tr>
<tr><td align="left" valign="top" headers="d0e185 ">2</td>
<td align="left" valign="top" headers="d0e187 ">Smith, Ron</td>
<td align="left" valign="top" headers="d0e189 ">45</td>
<td align="left" valign="top" headers="d0e191 ">41321</td>
</tr>
</tbody>
</table>
</td></tr></table>
<p>To use an alternative collating sequence for a character key field, specify
the ALTSEQ DDS keyword, and specify the name of the table containing the alternative
collating sequence. When setting up a table, each 2-byte position in the table
corresponds to a character. To change the order in which a character is sorted,
change its 2-digit value to the same value as the character it should be sorted
equal to. For information about sorting uppercase and lowercase characters
regardless of their case, the QCASE256 table in library QUSRSYS is provided
for you.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafoksapa.htm" title="A keyed sequence access path for database files is based on the contents of the key fields as defined in data description specifications (DDS). This topic describes how the key fields are arranged for the file.">Use a keyed sequence access path for database files</a></div>
</div>
</div>
</body>
</html>