ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/dtadnum.htm

119 lines
6.6 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="Conversion classes for numeric data" />
<meta name="abstract" content="Conversion classes for numeric data convert numeric data from the format used on the iSeries server (called server format in the following table) to the Java format." />
<meta name="description" content="Conversion classes for numeric data convert numeric data from the format used on the iSeries server (called server format in the following table) to the Java format." />
<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="dtadnum" />
<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>Conversion classes for numeric data</title>
</head>
<body id="dtadnum"><a name="dtadnum"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Conversion classes for numeric data</h1>
<div><p>Conversion classes for numeric data convert numeric data from the
format used on the iSeries™ server (called <strong>server format</strong> in the
following table) to the Java™ format.</p>
<div class="section"><p> Supported types are shown in the following table:</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><thead align="left"><tr class="tablemainheaderbar"><th valign="top" width="50%" id="d0e30">Numeric Type</th>
<th valign="top" width="50%" id="d0e32">Description</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="50%" headers="d0e30 "><a href="javadoc/com/ibm/as400/access/AS400Bin2.html#NAVBAR_TOP"> AS400Bin2</a></td>
<td valign="top" width="50%" headers="d0e32 ">Converts between a signed two-byte number in the server format to a Java Short
object.</td>
</tr>
<tr><td valign="top" width="50%" headers="d0e30 "><a href="javadoc/com/ibm/as400/access/AS400Bin4.html#NAVBAR_TOP"> AS400Bin4</a></td>
<td valign="top" width="50%" headers="d0e32 ">Converts between a signed four-byte number in the server format and
a Java Integer
object.</td>
</tr>
<tr><td valign="top" width="50%" headers="d0e30 "><a href="javadoc/com/ibm/as400/access/AS400ByteArray.html#NAVBAR_TOP"> AS400ByteArray</a></td>
<td valign="top" width="50%" headers="d0e32 ">Converts between two byte arrays. This is useful because the converter
correctly zero-fills and pads the target buffer.</td>
</tr>
<tr><td valign="top" width="50%" headers="d0e30 "><a href="javadoc/com/ibm/as400/access/AS400Float4.html#NAVBAR_TOP"> AS400Float4</a></td>
<td valign="top" width="50%" headers="d0e32 ">Converts between a signed four-byte floating point number in the server
format and a Java Float object.</td>
</tr>
<tr><td valign="top" width="50%" headers="d0e30 "><a href="javadoc/com/ibm/as400/access/AS400Float8.html#NAVBAR_TOP"> AS400Float8</a></td>
<td valign="top" width="50%" headers="d0e32 ">Converts between a signed eight-byte floating point number in the server
format and a Java Double object.</td>
</tr>
<tr><td valign="top" width="50%" headers="d0e30 "><a href="javadoc/com/ibm/as400/access/AS400PackedDecimal.html#NAVBAR_TOP"> AS400PackedDecimal</a></td>
<td valign="top" width="50%" headers="d0e32 ">Converts between a packed-decimal number in the server format and a Java BigDecimal
object.</td>
</tr>
<tr><td valign="top" width="50%" headers="d0e30 "><a href="javadoc/com/ibm/as400/access/AS400UnsignedBin2.html#NAVBAR_TOP"> AS400UnsignedBin2</a></td>
<td valign="top" width="50%" headers="d0e32 ">Converts between an unsigned two-byte number in the server format and
a Java Integer
object.</td>
</tr>
<tr><td valign="top" width="50%" headers="d0e30 "><a href="javadoc/com/ibm/as400/access/AS400UnsignedBin4.html#NAVBAR_TOP"> AS400UnsignedBin4</a></td>
<td valign="top" width="50%" headers="d0e32 ">Converts between an unsigned four-byte number in the server format
and a Java Long
object.</td>
</tr>
<tr><td valign="top" width="50%" headers="d0e30 "><a href="javadoc/com/ibm/as400/access/AS400ZonedDecimal.html#NAVBAR_TOP"> AS400ZonedDecimal</a></td>
<td valign="top" width="50%" headers="d0e32 ">Converts between a zoned-decimal number in the server format and a Java BigDecimal
object.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Examples</h4><p>The following examples show data conversions
that use a numeric type in the server format and a Java int:</p>
<p><strong>Example: Converting from
the server format to a Java int</strong></p>
<pre> // Create a buffer to hold the server data type. Assume the buffer is
// filled with numeric data in the server format by data queues,
// program call, and so on.
byte[] data = new byte[100];
// Create a converter for this server data type.
AS400Bin4 bin4Converter = new AS400Bin4();
// Convert from server type to Java object. The number starts at the
// beginning of the buffer.
Integer intObject = (Integer) bin4Converter.toObject(data,0);
// Extract the simple Java type from the Java object.
int i = intObject.intValue();</pre>
<p><strong>Example: Converting from
a Java int
to the server format</strong></p>
<pre> // Create a Java object that contains the value to convert.
Integer intObject = new Integer(22);
// Create a converter for the server data type.
AS400Bin4 bin4Converter = new AS400Bin4();
// Convert from Java object to server data type.
byte[] data = bin4Converter.toBytes(intObject);
// Find out how many bytes of the buffer were filled with the
// server value.
int length = bin4Converter.getByteLength();</pre>
</div>
</div>
</body>
</html>