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

70 lines
4.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="reference" />
<meta name="DC.Title" content="Record class" />
<meta name="abstract" content="The record class allows the Java program to process data described by the record format class." />
<meta name="description" content="The record class allows the Java program to process data described by the record format class." />
<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="dtadrec" />
<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>Record class</title>
</head>
<body id="dtadrec"><a name="dtadrec"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Record class</h1>
<div><p>The record class allows the Java™ program to process data described by
the record format class. </p>
<div class="section"><p><a href="javadoc/com/ibm/as400/access/Record.html#NAVBAR_TOP">Record</a> class</p>
<p>Data is converted between byte arrays
containing the server data and Java objects. Methods are provided in the
record class to do the following:</p>
<ul><li><a href="dtadrtv.htm#dtadrtv">Retrieve the contents</a> of a field,
by index or by name, as a Java object.</li>
<li><a href="javadoc/com/ibm/as400/access/Record.html#GETNUMBEROFFIELDS()"> Retrieve the number</a> of fields in the record.</li>
<li><a href="dtadset.htm#dtadset">Set the contents</a> of a field,
by index or by name, with a Java object.</li>
<li>Retrieve the contents of the record as server data <a href="javadoc/com/ibm/as400/access/Record.html#GETCONTENTS()">into
a byte array or output stream</a>.</li>
<li>Set the contents of the record <a href="javadoc/com/ibm/as400/access/Record.html#SETCONTENTS(BYTE[])">from a byte array or an input stream</a>.</li>
<li>Convert the contents of the record <a href="javadoc/com/ibm/as400/access/Record.html#TOSTRING()">to a String.</a></li>
</ul>
</div>
<div class="section"><h4 class="sectiontitle">Example: Reading a record</h4><p>The following example
uses the record format created in the <a href="dtadrfmt.htm#dtadrfmt">record
format</a> example:</p>
<pre> // Assume data queue setup work has already been done. Now read a
// record from the data queue.
DataQueueEntry dqe = dq.read();
// The data from the data queue is now in a data queue entry. Get
// the data out of the data queue entry and put it in the record.
// We obtain a default record from the record format object and
// initialize it with the data from the data queue entry.
Record dqRecord = rf.getNewRecord(dqe.getData());
// Now that the data is in the record, pull the data out one
// field at a time, converting the data as it is removed. The result
// is data in a Java object that the program can now process.
Integer msgNumber = (Integer) dqRecord.getField("msgNumber");
String msgTime = (String) dqRecord.getField("msgTime");
String msgText = (String) dqRecord.getField("msgText");</pre>
</div>
</div>
</body>
</html>