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

102 lines
5.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="LineDataRecordWriter class" />
<meta name="abstract" content="The LineDataRecordWriter class writes the record data, in line data format, to an OutputStream. The class translates the data into bytes by using the specified CCSID. The record format associated with the record determines the format of the data." />
<meta name="description" content="The LineDataRecordWriter class writes the record data, in line data format, to an OutputStream. The class translates the data into bytes by using the specified CCSID. The record format associated with the record determines the format of the data." />
<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="dtadldrw" />
<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>LineDataRecordWriter class</title>
</head>
<body id="dtadldrw"><a name="dtadldrw"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">LineDataRecordWriter class</h1>
<div><p>The LineDataRecordWriter class writes the record data, in line
data format, to an OutputStream. The class translates the data into bytes
by using the specified CCSID. The record format associated with the record
determines the format of the data.</p>
<div class="section"><p><a href="javadoc/com/ibm/as400/access/LineDataRecordWriter.html#NAVBAR_TOP"> LineDataRecordWriter</a> </p>
<p>Using LineDataRecordWriter
requires that the following record format attributes be set:</p>
<ul><li>Record format ID</li>
<li>Record format type</li>
</ul>
<p>In conjunction with the <a href="javadoc/com/ibm/as400/access/Record.html#NAVBAR_TOP">Record</a> or the <a href="javadoc/com/ibm/as400/access/RecordFormat.html#NAVBAR_TOP"> RecordFormat</a> classes, the LineDataRecordWriter takes
a record as input to the <a href="javadoc/com/ibm/as400/access/LineDataRecordWriter.html#WRITERECORD(COM.IBM.AS400.ACCESS.RECORD)"> writeRecord()</a> method. (Record takes a RecordFormat as
input when you instantiate it.)</p>
<p>The LineDataRecordWriter class provides
methods that allow you to:</p>
<ul><li><a href="javadoc/com/ibm/as400/access/LineDataRecordWriter.html#GETCCSID()">Get the CCSID</a></li>
<li><a href="javadoc/com/ibm/as400/access/LineDataRecordWriter.html#GETENCODING()">Get the name of the encoding</a></li>
<li><a href="javadoc/com/ibm/as400/access/LineDataRecordWriter.html#WRITERECORD(COM.IBM.AS400.ACCESS.RECORD)">Write the record data</a>, in line data format, to an OutputStream</li>
</ul>
</div>
<div class="section" id="dtadldrw__dtadldrwex"><a name="dtadldrw__dtadldrwex"><!-- --></a><h4 class="sectiontitle">Example: Using the LineDataRecordWriter class</h4><div class="note"><span class="notetitle">Note:</span> Read
the <a href="codedisclaimer.htm#codedisclaimer">Code example disclaimer</a> for
important legal information.</div>
<p>The following example shows one way
to use the LineDataRecordWriter class to write a record:</p>
<pre> // Example using the LineDataRecordWriter class.
try
{
// create a ccsid
ccsid_ = system_.getCcsid();
// create output queue and specify spooled file data to be *LINE
OutputQueue outQ = new OutputQueue(system_, "/QSYS.LIB/RLPLIB.LIB/LDRW.OUTQ");
PrintParameterList parms = new PrintParameterList();
parms.setParameter(PrintObject.ATTR_PRTDEVTYPE, "*LINE");
// initialize the record format for writing data
RecordFormat recfmt = initializeRecordFormat();
// create a record and assign data to be printed...
Record record = new Record(recfmt);
createRecord(record);
SpooledFileOutputStream os = null;
try {
// create the output spooled file to hold the record data
os = new SpooledFileOutputStream(system_, parms, null, outQ);
}
catch (Exception e) {
System.out.println("Error occurred creating spooled file");
e.printStackTrace();
}
// create the line data record writer
LineDataRecordWriter ldw;
ldw = new LineDataRecordWriter(os, ccsid_, system_);
// write the record of data
ldw.writeRecord(record);
// close the outputstream
os.close();
}
catch(Exception e)
{
failed(e, "Exception occurred.");
}</pre>
</div>
</div>
</body>
</html>