136 lines
7.9 KiB
HTML
136 lines
7.9 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="Database files and functions" />
|
||
|
<meta name="abstract" content="When you create Unicode database applications, you need to consider the implications for creating physical files, creating logical files, and for database input/output." />
|
||
|
<meta name="description" content="When you create Unicode database applications, you need to consider the implications for creating physical files, creating logical files, and for database input/output." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbagsucs2andas400.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbagsobjlev65534and65535.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="rbagsucs2dbfileconsid" />
|
||
|
<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>Database files and functions</title>
|
||
|
</head>
|
||
|
<body id="rbagsucs2dbfileconsid"><a name="rbagsucs2dbfileconsid"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Database files and functions</h1>
|
||
|
<div><p>When you create Unicode database applications, you need to consider
|
||
|
the implications for creating physical files, creating logical files, and
|
||
|
for database input/output.</p>
|
||
|
<div class="section" id="rbagsucs2dbfileconsid__Header_186"><a name="rbagsucs2dbfileconsid__Header_186"><!-- --></a><h4 class="sectiontitle">Create physical files</h4><p>Unicode graphic
|
||
|
fields can be created in physical files. This is done by specifying a G data
|
||
|
type and a Unicode CCSID for the CCSID keyword.</p>
|
||
|
<p>The following example
|
||
|
shows the DDS for a physical file containing four fields, and the command
|
||
|
for creating the file:</p>
|
||
|
<pre>A R FMT1
|
||
|
A EMPNO 6A
|
||
|
A NAME 30G CCSID(1200)
|
||
|
A DESCR1 500G CCSID(1200) VARLEN
|
||
|
A DESCR2 500A
|
||
|
|
||
|
CRTPF FILE(UNICODEPF) SRCFILE(CLR/QDDSSRC)</pre>
|
||
|
<p>In the example:</p>
|
||
|
<ul><li>The first field, <samp class="codeph">EMPNO</samp>, is a character field of length
|
||
|
6. The CCSID of the EMPNO field is the SBCS CCSID of the job. The decision
|
||
|
was made to use a character field because the EMPNO field contains only numerics
|
||
|
and Unicode support is not needed.</li>
|
||
|
<li>The <samp class="codeph">NAME</samp> and <samp class="codeph">DESCR1</samp> fields are both
|
||
|
Unicode fields. Both of these fields may need to contain data from more than
|
||
|
one EBCDIC code page so the decision was made to make these fields Unicode
|
||
|
graphic.</li>
|
||
|
<li>The <samp class="codeph">DESCR2</samp> field is the SBCS CCSID of the job. This field
|
||
|
is used as illustration of mapping to a logical field in <a href="#rbagsucs2dbfileconsid__HDRCRTLF">Creating
|
||
|
logical files</a>.</li>
|
||
|
</ul>
|
||
|
<p>You can specify the default (DFT) keyword for Unicode graphic fields.
|
||
|
The default value can be specified as SBCS, bracketed-DBCS, or bracketed-DBCS-graphic
|
||
|
character strings. If you do not specify the DFT keyword, the default value
|
||
|
for fixed-length Unicode fields is the Unicode blank (hexadecimal 0020). For
|
||
|
varying-length Unicode fields, the default is the empty string.</p>
|
||
|
</div>
|
||
|
<div class="section" id="rbagsucs2dbfileconsid__HDRCRTLF"><a name="rbagsucs2dbfileconsid__HDRCRTLF"><!-- --></a><h4 class="sectiontitle">Create logical files</h4><p>You can use logical
|
||
|
files to map Unicode data to and from character, DBCS-open, or DBCS-graphic.
|
||
|
This allows Unicode graphic data to be manipulated in a character based form.</p>
|
||
|
<p>The
|
||
|
following example shows the DDS for a logical file containing 4 character
|
||
|
fields. The Unicode graphic data is converted to character data when reading
|
||
|
from the logical file, and character data is converted to Unicode graphic
|
||
|
data when writing to the file.</p>
|
||
|
<pre>R FMT1 PFILE(UNICODEPF1)
|
||
|
A EMPNO
|
||
|
A NAME A CCSID(37)
|
||
|
A DESCR1 A CCSID(37)
|
||
|
A DESCR2 G CCSID(1200)</pre>
|
||
|
</div>
|
||
|
<div class="section" id="rbagsucs2dbfileconsid__Header_188"><a name="rbagsucs2dbfileconsid__Header_188"><!-- --></a><h4 class="sectiontitle">Database input/output</h4><p>Whenever reading
|
||
|
or writing data from or to a field tagged with a Unicode CCSID to the job
|
||
|
physical files, the data is passed as Unicode data without any conversions
|
||
|
occurring. Regardless of the job CCSID, data is passed as Unicode data. When
|
||
|
writing data to a logical file, the <em>from</em> CCSID is the job CCSID; however,
|
||
|
if the job CCSID is 65535, the <em>from</em> CCSID is the CCSID of the field
|
||
|
in the logical file.</p>
|
||
|
<p>Here are some scenarios from the
|
||
|
previous physical and logical files. For the scenarios, the job CCSID is 297.</p>
|
||
|
<p><strong>Scenario
|
||
|
1.</strong> When reading the data from the physical file:</p>
|
||
|
<ul><li>EMPNO is converted from its CCSID to 297.</li>
|
||
|
<li>NAME is not converted but is left as Unicode data.</li>
|
||
|
<li>DESCR1 is not converted but is left as Unicode data.</li>
|
||
|
<li>DESCR2 is converted from its CCSID to 297.</li>
|
||
|
</ul>
|
||
|
<p><strong>Scenario 2.</strong> When writing the data to the physical file:</p>
|
||
|
<ul><li>EMPNO is converted from 297 to its CCSID.</li>
|
||
|
<li>NAME is not converted but is left as Unicode data.</li>
|
||
|
<li>DESCR1 is not converted but is left as Unicode data.</li>
|
||
|
<li>DESCR2 is converted from 297 to its CCSID.</li>
|
||
|
</ul>
|
||
|
<p><strong>Scenario 3.</strong> When reading the data from the logical file:</p>
|
||
|
<ul><li>EMPNO is converted from its CCSID to 297.</li>
|
||
|
<li>NAME is converted from Unicode data to character data with a CCSID of
|
||
|
297.</li>
|
||
|
<li>DESCR1 is converted from Unicode data to character data with a CCSID of
|
||
|
297.</li>
|
||
|
<li>DESCR2 is converted from character data to Unicode data and not converted
|
||
|
to the job CCSID.</li>
|
||
|
</ul>
|
||
|
<p><strong>Scenario 4.</strong> When writing the data to the logical file:</p>
|
||
|
<ul><li>EMPNO is converted from 297 to its CCSID.</li>
|
||
|
<li>NAME is converted from 297 to Unicode data.</li>
|
||
|
<li>DESCR1 is converted from 297 to Unicode data.</li>
|
||
|
<li>DESCR2 is converted from Unicodeto its CCSID in the physical file.</li>
|
||
|
</ul>
|
||
|
<p><strong>Scenario 5.</strong> If the job was 65535, the conversions for the previous
|
||
|
fields are:</p>
|
||
|
<ul><li>EMPNO is not converted.</li>
|
||
|
<li>NAME is converted from 37 to Unicode data.</li>
|
||
|
<li>DESCR1 is converted from 37 to Unicode data.</li>
|
||
|
<li>DESCR2 is converted from Unicode to its CCSID in the physical file.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbagsucs2andas400.htm" title="i5/OS provides support for Unicode.">Unicode on i5/OS</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="rbagsobjlev65534and65535.htm" title="CCSID 65535 is the default object-level CCSID for message files and message queues.">Object-level coded character set identifier 65535</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|