104 lines
6.8 KiB
HTML
104 lines
6.8 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="Data conversion and description" />
|
|
<meta name="abstract" content="The data conversion classes provide the capability to convert numeric and character data between iSeries and Java formats. Conversion may be needed when accessing iSeries data from a Java program. The data conversion classes support conversion of various numeric formats and between various EBCDIC code pages and Unicode." />
|
|
<meta name="description" content="The data conversion classes provide the capability to convert numeric and character data between iSeries and Java formats. Conversion may be needed when accessing iSeries data from a Java program. The data conversion classes support conversion of various numeric formats and between various EBCDIC code pages and Unicode." />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="dtad" />
|
|
<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>Data conversion and description</title>
|
|
</head>
|
|
<body id="dtad"><a name="dtad"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Data conversion and description</h1>
|
|
<div><p>The <strong>data conversion</strong> classes provide the capability to convert
|
|
numeric and character data between iSeries™ and Java™ formats. Conversion may be needed
|
|
when accessing iSeries data
|
|
from a Java program. The data conversion classes support conversion
|
|
of various numeric formats and between various EBCDIC code pages and Unicode.</p>
|
|
<div class="section"><p>The <strong>data description</strong> classes build on the data conversion
|
|
classes to convert all fields in a record with a single method call. The
|
|
RecordFormat class allows the program to describe data that makes up a DataQueueEntry,
|
|
ProgramCall parameter, a record in a database file accessed through record-level
|
|
access classes, or any buffer of iSeries data. The Record class allows
|
|
the program to convert the contents of the record and access the data by
|
|
field name or index.</p>
|
|
<p>The <strong>converter</strong> classes provide fast and efficient
|
|
conversion between Java and your iSeries server. BinaryConverter converts
|
|
between Java byte arrays and Java simple types. CharConverter converts
|
|
between Java String objects and i5/OS™ code pages. For more information,
|
|
see the following:</p>
|
|
<blockquote><a href="progtipsperformance.htm#progtipsperformance__converters">Converters</a></blockquote>
|
|
</div>
|
|
<div class="section" id="dtad__datatypes"><a name="dtad__datatypes"><!-- --></a><h4 class="sectiontitle">Data types</h4><p>The <a href="javadoc/com/ibm/as400/access/AS400DataType.html#NAVBAR_TOP"> AS400DataType</a> is
|
|
an interface that defines the methods required for data conversion. A Java program
|
|
uses data types when individual pieces of data need to be converted. Conversion
|
|
classes exist for the following types of data:</p>
|
|
<ul><li><a href="dtadnum.htm#dtadnum">Numeric</a></li>
|
|
<li><a href="dtadtext.htm#dtadtext">Text (character)</a></li>
|
|
<li><a href="dtadcomp.htm#dtadcomp">Composite (numeric and text)</a></li>
|
|
</ul>
|
|
<p id="dtad__dtadexample"><a name="dtad__dtadexample"><!-- --></a><strong>Example: Using AS400DataType classes</strong></p>
|
|
<p>The
|
|
following example illustrates using AS400DataType classes with ProgramCall
|
|
to supply data for program parameters and to interpret the data returned
|
|
in program parameters.</p>
|
|
<blockquote><a href="dtxmp.htm#dtxmp">Example: Using
|
|
AS400DataType classes with ProgramCall</a></blockquote>
|
|
</div>
|
|
<div class="section" id="dtad__conversionspecifyingarecordformat"><a name="dtad__conversionspecifyingarecordformat"><!-- --></a><h4 class="sectiontitle">Conversion specifying
|
|
a record format</h4><p>The IBM<sup>®</sup> Toolbox for Java provides classes for building on the
|
|
data types classes to handle converting data one record at a time instead
|
|
of one field at a time. For example, suppose a Java program reads data off a data queue.
|
|
The data queue object returns a byte array of iSeries data to the Java program.
|
|
This array can potentially contain many types of iSeries data. The application can convert
|
|
one field at a time out of the byte array by using the data types classes,
|
|
or the program can create a record format that describes the fields in the
|
|
byte array. That record then does the conversion.</p>
|
|
<p>Record format conversion
|
|
can be useful when you are working with data from the program call, data
|
|
queue, and record-level access classes. The input and output from these classes
|
|
are byte arrays that can contain many fields of various types. Record format
|
|
converters can make it easier to convert this data between iSeries format
|
|
and Java format.</p>
|
|
<p>Conversion
|
|
through record format uses three classes:</p>
|
|
<ul><li><a href="dtadfld.htm#dtadfld">FieldDescription</a> classes identify
|
|
a field or parameter with a data type and a name.</li>
|
|
<li>A <a href="dtadrfmt.htm#dtadrfmt">RecordFormat</a> class describes
|
|
a group of fields.</li>
|
|
<li>A <a href="dtadrec.htm#dtadrec">Record</a> class joins the description
|
|
of a record (in the RecordFormat class) with the actual data.</li>
|
|
<li>A <a href="dtadldrw.htm#dtadldrw">LineDataRecordWriter</a> class
|
|
writes a record to an OutputStream in line data format</li>
|
|
</ul>
|
|
<p id="dtad__dtadconvexample"><a name="dtad__dtadconvexample"><!-- --></a><strong>Examples: Using record format conversion classes</strong></p>
|
|
<p>The
|
|
following examples illustrate using the record format conversion classes with
|
|
data queues:</p>
|
|
<blockquote><p><a href="dqproducerexample.htm#dqproducerexample">Using
|
|
the Record and RecordFormat classes to put data on a queue</a></p>
|
|
<p><a href="recordxmp.htm#recordxmp">Using the FieldDescription, RecordFormat,
|
|
and Record classes</a></p>
|
|
</blockquote>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |