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

113 lines
7.1 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="Concatenated fields" />
<meta name="abstract" content="Using the CONCAT keyword, you can combine two or more fields from a physical file record format to make one field in a logical file record format." />
<meta name="description" content="Using the CONCAT keyword, you can combine two or more fields from a physical file record format to make one field in a logical file record format." />
<meta name="DC.subject" content="concatenated field, field, concatenating" />
<meta name="keywords" content="concatenated field, field, concatenating" />
<meta name="DC.Relation" scheme="URI" content="rbafodescdrv.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="rbafoconfd" />
<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>Concatenated fields</title>
</head>
<body id="rbafoconfd"><a name="rbafoconfd"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Concatenated fields</h1>
<div><p>Using the CONCAT keyword, you can combine two or more fields from
a physical file record format to make one field in a logical file record format. </p>
<p> For example, a physical file record format contains the fields <em>Month</em>, <em>Day</em>,
and <em>Year</em>. For a logical file, you concatenate these fields into one
field, <em>Date</em>.</p>
<div class="p">The field length for the resulting concatenated field is the sum of the
lengths of the included fields (unless the fields in the physical file are
binary or packed decimal, in which case they are changed to zoned decimal).
The field length of the resulting field is automatically calculated by the
system. A concatenated field can have: <ul><li>Column headings</li>
<li>Validity checking</li>
<li>Text description</li>
<li>Edit code or edit word (numeric concatenated fields only)</li>
</ul>
<div class="note"><span class="notetitle">Note:</span> This editing and validity checking information is not used by the
database management system but is retrieved when field descriptions from the
database file are referred to in a display or printer file.</div>
</div>
<div class="p">When fields are concatenated, the data types can change (the resulting
data type is automatically determined by the system). The following rules
and restrictions apply: <ul><li>The operating system assigns the data type based on
the data types of the fields that are being concatenated.</li>
<li>The maximum length of a concatenated field varies depending on the data
type of the concatenated field and the length of the fields being concatenated.
If the concatenated field is zoned decimal (S), its total length cannot exceed
31 bytes; if it is character (A), its total length cannot exceed 32 766 bytes.</li>
<li>In join logical files, the fields to be concatenated must be from the
same physical file. The first field specified on the CONCAT keyword identifies
which physical file is to be used. The first field must, therefore, be unique
among the physical files on which the logical file is based, or you must also
specify the JREF keyword to specify which physical file to use.</li>
<li>The use of a concatenated field must be I (input only) if the concatenated
field is variable length. Otherwise, the use can be B (both input and output).</li>
<li>REFSHIFT cannot be specified on a concatenated field that has been assigned
a data type of O or J.</li>
<li>If any of the fields contain the null value, the result of concatenation
is the null value.</li>
</ul>
<div class="note"><span class="notetitle">Note:</span> For information about concatenating DBCS fields, see <a href="rbafoappdbcs.htm#rbafoappdbcs">Double-byte character set considerations</a>.</div>
When
only numeric fields are concatenated, the sign of the last field in the group
is used as the sign of the concatenated field. <div class="note"><span class="notetitle">Notes:</span> <ol><li>Numeric fields with decimal precision other than zero cannot be included
in a concatenated field.</li>
<li>Date, time, timestamp, and floating-point fields cannot be included in
a concatenated field.</li>
</ol>
</div>
</div>
<p>The following example shows the field description in data description specifications
(DDS) for concatenation. (The CONCAT keyword is used to specify the fields
to concatenate.)</p>
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A
00101A MONTH
00102A DAY
00103A YEAR
00104A DATE CONCAT(MONTH DAY YEAR)
A</pre>
<div class="p">In this example, the logical file record format includes the separate fields
of <em>Month</em>, <em>Day</em>, and <em>Year</em>, as well as the concatenated <em>Date</em> field.
Any of the following formats can be used: <ul><li>A format with the separate fields of <em>Month</em>, <em>Day</em>, and <em>Year</em></li>
<li>A format with only the concatenated <em>Date</em> field</li>
<li>A format with the separate fields <em>Month</em>, <em>Day</em>, <em>Year</em> and
the concatenated <em>Date</em> field</li>
</ul>
</div>
<p>When both separate and concatenated fields exist in the format, any updates
to the fields are processed in the sequence in which the DDS is specified.
In the previous example, if the <em>Date</em> field contained 103188 and the <em>Month</em> field
is changed to 12, when the record is updated, the month in the <em>Date</em> field
would be used. The updated record would contain 103188. If the <em>Date</em> field
were specified first, the updated record would contain 123188.</p>
<p>Concatenated fields can also be used as key fields and select/omit fields.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafodescdrv.htm" title="Fields in a logical file can be derived from fields in the physical file on which the logical file is based or from fields in the same logical file.">Derive new fields from existing fields</a></div>
</div>
</div>
</body>
</html>