215 lines
12 KiB
HTML
215 lines
12 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="reference" />
|
|
<meta name="DC.Title" content="Example: Describe a physical file using DDS" />
|
|
<meta name="abstract" content="This example shows how to describe a physical a file using DDS." />
|
|
<meta name="description" content="This example shows how to describe a physical a file using DDS." />
|
|
<meta name="DC.subject" content="example, describing, physical files with DDS, physical files with DDS, physical file, with DDS, example, physical file, using, DDS to describe, example, DDS (data description specifications), physical file, example, data description specifications (DDS), physical file, example, UNIQUE (Unique) keyword, keyword, DDS, UNIQUE (Unique)" />
|
|
<meta name="keywords" content="example, describing, physical files with DDS, physical files with DDS, physical file, with DDS, example, physical file, using, DDS to describe, example, DDS (data description specifications), physical file, example, data description specifications (DDS), physical file, example, UNIQUE (Unique) keyword, keyword, DDS, UNIQUE (Unique)" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafodescdds.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="rbafoexdphy" />
|
|
<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: Describe a physical file using DDS</title>
|
|
</head>
|
|
<body id="rbafoexdphy"><a name="rbafoexdphy"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Describe a physical file using DDS</h1>
|
|
<div><p>This example shows how to describe a physical a file using DDS.</p>
|
|
<div class="section"><div class="p">The DDS for a physical file, as shown in the next example, must
|
|
be in the following order: <dl><dt class="dlterm"><span class="uicontrol">1</span></dt>
|
|
<dd>File-level entries (optional). The UNIQUE keyword is used to indicate
|
|
that the value of the key field in each record in the file must be unique.
|
|
Duplicate key values are not allowed in this file.</dd>
|
|
<dt class="dlterm"><span class="uicontrol">2</span></dt>
|
|
<dd>Record format level entries. The record format name is specified, along
|
|
with an optional text description.</dd>
|
|
<dt class="dlterm"><span class="uicontrol">3</span></dt>
|
|
<dd>Field-level entries. The field names and field lengths are specified,
|
|
along with an optional text description for each field.</dd>
|
|
<dt class="dlterm"><span class="uicontrol">4</span></dt>
|
|
<dd>Key field level entries (optional). The field names used as key fields
|
|
are specified.</dd>
|
|
<dt class="dlterm"><span class="uicontrol">5</span></dt>
|
|
<dd>Comment (optional).</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="example"> <pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
|
A* ORDER HEADER FILE (ORDHDRP)
|
|
A <strong></strong>5
|
|
A <strong>1</strong> UNIQUE
|
|
A <strong>2</strong> R ORDHDR TEXT('Order header record')
|
|
A <strong>3</strong> CUST 5 0 TEXT('Customer number')
|
|
A ORDER 5 0 TEXT('Order number')
|
|
A .
|
|
A .
|
|
A .
|
|
A K CUST
|
|
A <strong>4</strong> K ORDER</pre>
|
|
</div>
|
|
<div class="section"><p>The following example shows a physical file ORDHDRP (an order
|
|
header file), with an arrival sequence access path without key fields specified,
|
|
and the DDS necessary to describe that file.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Record format of physical file ORDHDRP</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><tbody><tr><td valign="top">Customer number (CUST) — Packed decimal length 5, No
|
|
decimals</td>
|
|
</tr>
|
|
<tr><td valign="top">Order number (ORDER) — Packed Decimal Length 5, No decimals</td>
|
|
</tr>
|
|
<tr><td valign="top">Order date (ORDATE) — Packed decimal length 6, No decimals</td>
|
|
</tr>
|
|
<tr><td valign="top">Purchase order number (CUSORD) — Packed decimal length
|
|
15, No decimals</td>
|
|
</tr>
|
|
<tr><td valign="top">Shipping instructions (SHPVIA) — Character length 15</td>
|
|
</tr>
|
|
<tr><td valign="top">Order status (ORDSTS) — Character length 1</td>
|
|
</tr>
|
|
<tr><td valign="top">...</td>
|
|
</tr>
|
|
<tr><td valign="top">State (STATE) — Character length 2</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="example"> <pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
|
|
A* ORDER HEADER FILE (ORDHDRP)
|
|
A R ORDHDR TEXT('Order header record')
|
|
A CUST 5 0 TEXT('Customer Number')
|
|
A ORDER 5 0 TEXT('Order Number')
|
|
A ORDATE 6 0 TEXT('Order Date')
|
|
A CUSORD 15 0 TEXT('Customer Order No.')
|
|
A SHPVIA 15 TEXT('Shipping Instr')
|
|
A ORDSTS 1 TEXT('Order Status')
|
|
A OPRNME 10 TEXT('Operator Name')
|
|
A ORDAMT 9 2 TEXT('Order Amount')
|
|
A CUTYPE 1 TEXT('Customer Type')
|
|
A INVNBR 5 0 TEXT('Invoice Number')
|
|
A PRTDAT 6 0 TEXT('Printed Date')
|
|
A SEQNBR 5 0 TEXT('Sequence Number')
|
|
A OPNSTS 1 TEXT('Open Status')
|
|
A LINES 3 0 TEXT('Order Lines')
|
|
A ACTMTH 2 0 TEXT('Accounting Month')
|
|
A ACTYR 2 0 TEXT('Accounting Year')
|
|
A STATE 2 TEXT('State')
|
|
A</pre>
|
|
</div>
|
|
<div class="section"><p>The R in position 17 indicates that a record format is being defined.
|
|
The record format name ORDHDR is specified in positions 19 through 28.</p>
|
|
</div>
|
|
<div class="section"><p>You make no entry in position 17 when you are describing a field;
|
|
a blank in position 17 along with a name in positions 19 through 28 indicates
|
|
a field name.</p>
|
|
</div>
|
|
<div class="section"><div class="p">The data type is specified in position 35. The valid data types
|
|
are: <dl><dt><strong>Entry</strong></dt>
|
|
<dd><strong>Meaning</strong></dd>
|
|
<dt class="dlterm">A</dt>
|
|
<dd>Character</dd>
|
|
<dt class="dlterm">P</dt>
|
|
<dd>Packed decimal</dd>
|
|
<dt class="dlterm">S</dt>
|
|
<dd>Zoned decimal</dd>
|
|
<dt class="dlterm">B</dt>
|
|
<dd>Binary</dd>
|
|
<dt class="dlterm">F</dt>
|
|
<dd>Floating point</dd>
|
|
<dt class="dlterm">H</dt>
|
|
<dd>Hexadecimal</dd>
|
|
<dt class="dlterm">L</dt>
|
|
<dd>Date</dd>
|
|
<dt class="dlterm">T</dt>
|
|
<dd>Time</dd>
|
|
<dt class="dlterm">Z</dt>
|
|
<dd>Timestamp</dd>
|
|
</dl>
|
|
<div class="note"><span class="notetitle">Notes:</span> <ol><li>For double-byte character set (DBCS) data types, see <a href="rbafoappdbcs.htm#rbafoappdbcs">Double-byte character set considerations</a>.</li>
|
|
<li>The <span class="keyword">iSeries™</span> system performs
|
|
arithmetic operations more efficiently for packed decimal than for zoned decimal.</li>
|
|
<li>Some high-level languages do not support floating-point data.</li>
|
|
<li>Some special considerations that apply when you are using floating-point
|
|
fields are: <ul><li>The precision associated with a floating-point field is a function of
|
|
the number of bits (single or double precision) and the internal representation
|
|
of the floating-point value. This translates into the number of decimal digits
|
|
supported in the significant and the maximum values that can be represented
|
|
in the floating-point field.</li>
|
|
<li>When a floating-point field is defined with fewer digits than supported
|
|
by the precision specified, that length is only a presentation length and
|
|
has no effect on the precision used for internal calculations.</li>
|
|
<li>Although floating-point numbers are accurate to 7 (single) or 15 (double)
|
|
decimal digits of precision, you can specify up to 9 or 17 digits. You can
|
|
use the extra digits to uniquely establish the internal bit pattern in the
|
|
internal floating-point format so identical results are obtained when a floating-point
|
|
number in internal format is converted to decimal and back again to internal
|
|
format.</li>
|
|
</ul>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="section"><p>If the data type (position 35) is not specified, the decimal positions
|
|
entry is used to determine the data type. If the decimal positions (positions
|
|
36 through 37) are blank, the data type is assumed to be character (A); if
|
|
these positions contain a number 0 through 31, the data type is assumed to
|
|
be packed decimal (P).</p>
|
|
</div>
|
|
<div class="section"><p>The length of the field is specified in positions 30 through 34,
|
|
and the number of decimal positions (for numeric fields) is specified in positions
|
|
36 and 37. If a packed or zoned decimal field is to be used in a high-level
|
|
language program, the field length must be limited to the length allowed by
|
|
the high-level language you are using. The length is not the length of the
|
|
field in storage but the number of digits or characters specified externally
|
|
from storage. For example, a 5-digit packed decimal field has a length of
|
|
5 specified in DDS, but it uses only 3 bytes of storage.</p>
|
|
</div>
|
|
<div class="section"><p>Character or hexadecimal data can be defined as variable length
|
|
by specifying the VARLEN field-level keyword. Generally you would
|
|
use variable length fields, for example, as an employee name within a database.
|
|
Names usually can be stored in a 30-byte field; however, there are times when
|
|
you need 100 bytes to store a very long name. If you always define the field
|
|
as 100 bytes, you waste storage. If you always define the field as 30 bytes,
|
|
some names are truncated.</p>
|
|
</div>
|
|
<div class="section"><div class="p">You can use the DDS VARLEN keyword to define a character field
|
|
as variable length. You can define this field as: <ul><li>Variable-length with no allocated length. This allows the field to be
|
|
stored using only the number of bytes equal to the data (plus two bytes per
|
|
field for the length value and a few overhead bytes per record). However,
|
|
performance might be affected because all data is stored in the variable portion
|
|
of the file, which requires two disk read operations to retrieve.</li>
|
|
<li>Variable-length with an allocated length equal to the most likely size
|
|
of the data. This allows most field data to be stored in the fixed portion
|
|
of the file and minimizes unused storage allocations common with fixed-length
|
|
field definitions. Only one read operation is required to retrieve field data
|
|
with a length less than the allocated field length. Field data with a length
|
|
greater than the allocated length is stored in the variable portion of the
|
|
file and requires two read operations to retrieve the data.</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafodescdds.htm" title="When you describe a database file using data description specifications (DDS), you can describe information at the file, record-format, join, field, key, and select/omit levels.">Describe database files using DDS</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |