ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzakb_5.4.0.1/rzakbmstlconcat.htm

186 lines
11 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="reference" />
<meta name="DC.Title" content="CONCAT (Concatenate) keyword—logical files only" />
<meta name="abstract" content="Use this field-level keyword when you want to combine two or more fields from the physical file record format into one field in the logical file record format you are defining. The name of this concatenated field must appear in positions 19 through 28." />
<meta name="description" content="Use this field-level keyword when you want to combine two or more fields from the physical file record format into one field in the logical file record format you are defining. The name of this concatenated field must appear in positions 19 through 28." />
<meta name="DC.subject" content="CONCAT (Concatenate) keyword" />
<meta name="keywords" content="CONCAT (Concatenate) keyword" />
<meta name="DC.Relation" scheme="URI" content="rzakbmstlfkeyw.htm" />
<meta name="DC.Relation" scheme="URI" content="fieldname.htm" />
<meta name="DC.Relation" scheme="URI" content="lkeynm.htm" />
<meta name="DC.Relation" scheme="URI" content="dbcconcat.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="lconcat" />
<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>Physical and Logical Files, CONCAT</title>
</head>
<body id="lconcat"><a name="lconcat"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">CONCAT (Concatenate) keyword—logical files only </h1>
<div><p>Use this field-level keyword when you want to combine two or more
fields from the physical file record format into one field in the logical
file record format you are defining. The name of this concatenated field must
appear in positions 19 through 28.</p>
<div class="section"><div class="p">The format of the keyword is: <pre>CONCAT(field-1 field-2...)</pre>
</div>
<p>Specify
the physical file field names in the order in which you want them to be concatenated,
and separate them by blanks.</p>
<p>If the same physical field is specified
more than once in a record format in the logical file (that is, by using either
RENAME or CONCAT), the sequence in which the fields are specified in the logical
file is the sequence in which the data is moved to the physical file on an
update or insert operation. Thus, the value in the last occurrence of the
physical field is the value that is put in the physical record and is the
value that is used for all keys built over that physical field. All previous
values of the same field are ignored.</p>
<p>If you want to use a field defined
using the CONCAT keyword or a field specified as a parameter value on the
CONCAT keyword as a key field, see the Key field name topic.</p>
<p>Binary
character fields can be concatenated only with other binary character fields.
UTF-8 fields can be concatenated only with other UTF-8 fields. UCS-2 and UTF-16
fields can be concatenated only with fields of the same type or with each
other.</p>
<p>You cannot include a field containing decimal positions other
than zero in a concatenated field. You can include a field having decimal
positions of zero in which case the field is treated as an integer field.</p>
<p>The <span class="keyword">i5/OS™</span> program assigns the length
of the concatenated field as the sum of the lengths (digits and characters)
of the fields included in the concatenation.</p>
<div class="p">The operating system assigns
the field to be fixed length or variable length based on the fields that are
concatenated. The general rules are: <ul><li>Concatenation of a variable-length field to either a fixed-length field
or another variable-length field results in a variable-length field.</li>
<li>Concatenation of a fixed-length field to a fixed-length field results
in a fixed-length field unless the VARLEN keyword is also specified on the
same field as the CONCAT keyword. <div class="note"><span class="notetitle">Note:</span> If the result of the concatenation
is a variable-length field, a field that allows the null value, a UCS-2 field,
a UTF-16 field, a UTF-8 field, or a binary character field, the CONCAT field
must be input only (I in position 38). If a logical file record format contains
a concatenation, it cannot contain any fields that allow the null value from
the physical file record format of the based-on file.</div>
</li>
</ul>
</div>
<div class="p">The operating system assigns the data type based on the data types
of the fields that are being concatenated. The general rules are: <ul><li>If the concatenation contains one or more hexadecimal (H) fields, the
resulting data type is hexadecimal (H).</li>
<li>If the concatenation contains one or more character (A) fields, but no
hexadecimal fields, the resulting data type is character (A).</li>
<li>If the concatenation contains only numeric (S, P, B) fields, the resulting
data type is zoned decimal (S).</li>
<li>If the concatenation contains UTF-8 fields, the result is a UTF-8 field.</li>
<li>If the concatenation contains UCS-2 or UTF-16 field, the result is UTF-16
if there is at least one UTF-16 field in the list; otherwise, the result is
UCS-2.</li>
<li>If the concatenation contains binary character fields, the result is binary
character.</li>
</ul>
</div>
<p>When concatenating numeric fields, the sign of the farthest right
field in the concatenation is used as the sign of the concatenated field.
The signs of the other fields are ignored; however, they are present in the
concatenated field. Therefore, if a negative value appears in a field other
than the last field, you must take appropriate action to delete
the embedded signs (such as converting the concatenated field to packed decimal).</p>
<p>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
63 bytes. If the field is character (A) or hexadecimal (H), its total length
cannot exceed 32 766 bytes. If the concatenated field is a variable length
field, its total length cannot exceed 32 740 (32 739 if the field
also allows the null value).</p>
<p>You cannot include a floating-point, date,
time, or timestamp field in a concatenated field.</p>
<p>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 used.
The first field must, therefore, be unique among the physical files the join
logical file is based on, or you must also specify the JREF keyword following
the CONCAT keyword to specify which physical file to use.</p>
</div>
<div class="section"><h4 class="sectiontitle">Examples</h4><p>The following examples show how to specify
the CONCAT keyword.</p>
</div>
<div class="example"><h4 class="sectiontitle">Example 1</h4> <p>MTH, DAY, and YEAR are fields in the
physical file that are concatenated into one field DATE in the logical file,
as shown in the following example.</p>
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R RECORD1 PFILE(PF1)
00020A DATE CONCAT(MTH DAY YEAR)
A</pre>
</div>
<div class="example"><h4 class="sectiontitle">Example 2</h4><p>In the following example, if the program
changes DATE from 01 03 81 to 02 05 81, the value placed in the physical record
does not change because the fields specified last are MTH (value 01), DAY
(value 03), and YEAR (value 81). However, if MTH, DAY, and YEAR are changed
to new values, the value of DATE in the physical record also changes.</p>
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R RECORD2 PFILE(PF1)
00020A DATE CONCAT(MTH DAY YEAR)
00030A MTH
00040A DAY
00050A YEAR
A</pre>
</div>
<div class="example"><h4 class="sectiontitle">Example 3</h4><p>In the following example, fields from
the physical file are concatenated into more than one field in the logical
file.</p>
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R RECORD3 PFILE(PF1)
00020A DATE CONCAT(MTH DAY YEAR)
00030A CMPDAT CONCAT(DAY MTH YEAR)
A</pre>
</div>
<div class="example"><h4 class="sectiontitle">Example 4</h4> <div class="p">In the following example, if the fields
from PF1 are: <ul><li>FIXED1 is a fixed length field.</li>
<li>FIXED2 is a fixed length field.</li>
<li>VARLEN1 is a variable length field.</li>
</ul>
</div>
<div class="p">The resulting fields are: <ul><li>FIELD1 is a variable length field.</li>
<li>FIELD2 is a fixed length field.</li>
<li>FIELD3 is a variable length field.</li>
</ul>
</div>
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R RECORD4 PFILE(PF1)
00020A FIELD1 CONCAT(FIXED1 VARLEN1)
00030A FIELD2 CONCAT(FIXED1 FIXED2)
00040A FIELD3 CONCAT(FIXED1 FIXED2)
00050A VARLEN
A</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzakbmstlfkeyw.htm" title="This topic lists valid keyword entries for describing physical and logical files. They are typed in positions 45 through 80 (functions).">Keyword entries for physical and logical files (positions 45 through 80)</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="fieldname.htm" title="When position 17 is left blank, the name specified in positions 19 through 28 is a field name.">Field name</a></div>
<div><a href="lkeynm.htm" title="When you specify K in position 17, the name specified in positions 19 through 28 is a key field name.">Key field name</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="dbcconcat.htm" title="Use this field-level keyword when you want to combine two or more fields from the physical file record format into one field in the logical file record format you are describing.">CONCAT (Concatenate) keyword</a></div>
</div>
</div>
</body>
</html>