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

202 lines
9.9 KiB
HTML
Raw 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="Example: Using RecordListRowData" />
<meta name="abstract" content="" />
<meta name="description" content="" />
<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="recdtout" />
<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>Example: Using RecordListRowData</title>
</head>
<body id="recdtout"><a name="recdtout"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Using RecordListRowData</h1>
<div><p></p>
<div class="section"><p>This example has three parts:</p>
</div>
<div class="section"><ul><li> <a href="#recdtout__javarecordlistrowdata">Java™ source</a> that shows how the RecordListRowData
class works</li>
<li> <a href="#recdtout__htmlrecordlistrowdata">HTML source</a> generated
from the Java source by the using <a href="tablconv.htm#tablconv">HTMLTableConverter</a></li>
<li> <a href="#recdtout__displayrecordlistrowdata">How a browser displays
the generated HTML</a></li>
</ul>
</div>
<div class="section"><div class="p"><strong><span class="synph" id="recdtout__javarecordlistrowdata"><a name="recdtout__javarecordlistrowdata"><!-- --></a><span class="kwd"></span></span>Java source
that shows how the RecordListRowData class works</strong> <pre> // Create a server object.
AS400 mySystem = new AS400 ("mySystem.myComp.com", "UserId", "Password");
// Get the path name for the file.
QSYSObjectPathName file = new QSYSObjectPathName(myLibrary, myFile, "%first%", "mbr");
String ifspath = file.getPath();
// Create a file object that represents the file.
SequentialFile sf = new SequentialFile(mySystem, ifspath);
// Retrieve the record format from the file.
AS400FileRecordDescription recordDescription = new AS400FileRecordDescription(mySystem, ifspath);
RecordFormat recordFormat = recordDescription.retrieveRecordFormat()[0];
// Set the record format for the file.
sf.setRecordFormat(recordFormat);
// Get the records in the file.
Record[] records = sf.readAll();
// Create a RecordListRowData object and add the records.
RecordListRowData rowData = new RecordListRowData(recordFormat);
for (int i=0; i &lt; records.length; i++)
{
rowData.addRow(records[i]);
}
// Create an HTML converter object and convert the rowData to HTML.
HTMLTableConverter conv = new HTMLTableConverter();
conv.setMaximumTableSize(3);
HTMLTable[] html = conv.convertToTables(rowData);
// Display the first HTML table generated by the converter.
System.out.println(html[0]);</pre>
<strong><span class="synph" id="recdtout__htmlrecordlistrowdata"><a name="recdtout__htmlrecordlistrowdata"><!-- --></a><span class="kwd"></span></span>HTML
source generated from the Java source by the using HTMLTableConverter</strong></div>
</div>
<div class="section"><p>Using the <a href="tablconv.htm#tablconv">HTMLTableConverter</a> class
in the Java source example above generates the following HTML
code.</p>
</div>
<div class="section"><div class="p"><pre>&lt;table&gt;
&lt;tr&gt;
&lt;th&gt;CNUM&lt;/th&gt;
&lt;th&gt;LNAM&lt;/th&gt;
&lt;th&gt;INIT&lt;/th&gt;
&lt;th&gt;STR&lt;/th&gt;
&lt;th&gt;CTY&lt;/th&gt;
&lt;th&gt;STATE&lt;/th&gt;
&lt;th&gt;ZIP&lt;/th&gt;
&lt;th&gt;CTLMT&lt;/th&gt;
&lt;th&gt;CHGCOD&lt;/th&gt;
&lt;th&gt;BDUE&lt;/th&gt;
&lt;th&gt;CTDUE&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;938472&lt;/td&gt;
&lt;td&gt;Henning &lt;/td&gt;
&lt;td&gt;G K&lt;/td&gt;
&lt;td&gt;4859 Elm Ave &lt;/td&gt;
&lt;td&gt;Dallas&lt;/td&gt;
&lt;td&gt;TX&lt;/td&gt;
&lt;td align="right"&gt;75217&lt;/td&gt;
&lt;td align="right"&gt;5000&lt;/td&gt;
&lt;td align="right"&gt;3&lt;/td&gt;
&lt;td align="right"&gt;37.00&lt;/td&gt;
&lt;td align="right"&gt;0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;839283&lt;/td&gt;
&lt;td&gt;Jones &lt;/td&gt;
&lt;td&gt;B D&lt;/td&gt;
&lt;td&gt;21B NW 135 St&lt;/td&gt;
&lt;td&gt;Clay &lt;/td&gt;
&lt;td&gt;NY&lt;/td&gt;
&lt;td align="right"&gt;13041&lt;/td&gt;
&lt;td align="right"&gt;400&lt;/td&gt;
&lt;td align="right"&gt;1&lt;/td&gt;
&lt;td align="right"&gt;100.00&lt;/td&gt;
&lt;td align="right"&gt;0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;392859&lt;/td&gt;
&lt;td&gt;Vine &lt;/td&gt;
&lt;td&gt;S S&lt;/td&gt;
&lt;td&gt;PO Box 79 &lt;/td&gt;
&lt;td&gt;Broton&lt;/td&gt;
&lt;td&gt;VT&lt;/td&gt;
&lt;td align="right"&gt;5046&lt;/td&gt;
&lt;td align="right"&gt;700&lt;/td&gt;
&lt;td align="right"&gt;1&lt;/td&gt;
&lt;td align="right"&gt;439.00&lt;/td&gt;
&lt;td align="right"&gt;0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</pre>
<strong><span class="synph" id="recdtout__displayrecordlistrowdata"><a name="recdtout__displayrecordlistrowdata"><!-- --></a><span class="kwd"></span></span>How
a browser displays the generated HTML</strong></div>
</div>
<div class="section"><p>The following table shows how the HTML source code looks when
viewed in a browser.</p>
</div>
<div class="section"><div class="p">
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="void" border="0" rules="none"><thead align="left"><tr><th valign="top" width="5.769230769230769%" id="d0e94">CNUM</th>
<th valign="top" width="8.241758241758241%" id="d0e96">LNAM</th>
<th valign="top" width="5.21978021978022%" id="d0e98">INIT</th>
<th valign="top" width="16.208791208791208%" id="d0e100">STR</th>
<th valign="top" width="6.868131868131869%" id="d0e102">CTY</th>
<th valign="top" width="6.868131868131869%" id="d0e104">STATE</th>
<th valign="top" width="7.6923076923076925%" id="d0e106">ZIP</th>
<th align="right" valign="top" width="12.637362637362637%" id="d0e108">CTLMT</th>
<th valign="top" width="10.164835164835164%" id="d0e110">CHGCOD</th>
<th align="right" valign="top" width="9.89010989010989%" id="d0e112">BDUE</th>
<th align="right" valign="top" width="10.43956043956044%" id="d0e114">CTDUE</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="5.769230769230769%" headers="d0e94 ">938472</td>
<td valign="top" width="8.241758241758241%" headers="d0e96 ">Henning</td>
<td valign="top" width="5.21978021978022%" headers="d0e98 ">G K</td>
<td valign="top" width="16.208791208791208%" headers="d0e100 ">4859 Elm Ave</td>
<td align="left" valign="top" width="6.868131868131869%" headers="d0e102 ">Dallas</td>
<td align="left" valign="top" width="6.868131868131869%" headers="d0e104 ">TX</td>
<td align="left" valign="top" width="7.6923076923076925%" headers="d0e106 ">75217</td>
<td align="right" valign="top" width="12.637362637362637%" headers="d0e108 ">5000</td>
<td align="center" valign="top" width="10.164835164835164%" headers="d0e110 ">3</td>
<td align="right" valign="top" width="9.89010989010989%" headers="d0e112 ">37.00</td>
<td align="right" valign="top" width="10.43956043956044%" headers="d0e114 ">0.00</td>
</tr>
<tr><td valign="top" width="5.769230769230769%" headers="d0e94 ">839283</td>
<td valign="top" width="8.241758241758241%" headers="d0e96 ">Jones</td>
<td valign="top" width="5.21978021978022%" headers="d0e98 ">B D</td>
<td valign="top" width="16.208791208791208%" headers="d0e100 ">21B NW 135 St</td>
<td align="left" valign="top" width="6.868131868131869%" headers="d0e102 ">Clay</td>
<td valign="top" width="6.868131868131869%" headers="d0e104 ">NY</td>
<td align="left" valign="top" width="7.6923076923076925%" headers="d0e106 ">13041</td>
<td align="right" valign="top" width="12.637362637362637%" headers="d0e108 ">400</td>
<td align="center" valign="top" width="10.164835164835164%" headers="d0e110 ">1</td>
<td align="right" valign="top" width="9.89010989010989%" headers="d0e112 ">100.00</td>
<td align="right" valign="top" width="10.43956043956044%" headers="d0e114 ">0.00</td>
</tr>
<tr><td valign="top" width="5.769230769230769%" headers="d0e94 ">392859</td>
<td valign="top" width="8.241758241758241%" headers="d0e96 ">Vine</td>
<td valign="top" width="5.21978021978022%" headers="d0e98 ">S S</td>
<td valign="top" width="16.208791208791208%" headers="d0e100 ">PO Box 79</td>
<td align="left" valign="top" width="6.868131868131869%" headers="d0e102 ">Broton</td>
<td valign="top" width="6.868131868131869%" headers="d0e104 ">VT</td>
<td align="left" valign="top" width="7.6923076923076925%" headers="d0e106 ">5046</td>
<td align="right" valign="top" width="12.637362637362637%" headers="d0e108 ">700</td>
<td align="center" valign="top" width="10.164835164835164%" headers="d0e110 ">1</td>
<td align="right" valign="top" width="9.89010989010989%" headers="d0e112 ">439.00</td>
<td align="right" valign="top" width="10.43956043956044%" headers="d0e114 ">0.00</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>