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

110 lines
6.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="Creating new spooled files" />
<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="printsf" />
<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>Creating new spooled files</title>
</head>
<body id="printsf"><a name="printsf"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Creating new spooled files</h1>
<div><p></p>
<div class="section"><p>You can use the <a href="javadoc/com/ibm/as400/access/SpooledFileOutputStream.html#NAVBAR_TOP"> SpooledFileOutputStream</a> class to create new server spooled
files. The class derives from the standard JDK java.io.OutputStream class;
after its construction, it can be used anywhere an OutputStream is used.</p>
<p>When
creating a new SpooledFileOutputStream, the caller may specify the following:</p>
<ul><li>Which printer file to use</li>
<li>Which output queue to put the spooled file on</li>
<li>A PrintParameterList object that may contain parameters to override fields
in the printer file</li>
</ul>
<p>These parameters are all optional (the caller may pass null of any
or all of them). If a printer file is not specified, the network print server
uses the default network print printer file, QPNPSPRTF. The output queue parameter
is there as a convenience; it also can be specified in the PrintParameterList.
If the output queue parameter is specified in both places, the PrintParameterList
field overrides the output queue parameter. See the documentation of the <a href="javadoc/com/ibm/as400/access/SpooledFileOutputStream.html#CONSTRUCTOR_DETAIL"> SpooledFileOutputStream constructor</a> for a complete list
of which attributes may be set in the PrintParameterList for creating new
spooled files.</p>
<p>Use one of the <a href="javadoc/com/ibm/as400/access/SpooledFileOutputStream.html#WRITE(INT)"> write()</a> methods to write data into the spooled file.
The SpooledFileOutputStream object buffers the data and sends it when either
the output stream is closed or the buffer is full. Buffering is done for two
reasons:</p>
<ul><li>It allows the automatic data typing (see <a href="#printsf__datastreamtypes">Data
stream types in spooled files</a>) to analyze a full-buffer of data to
determine the data type</li>
<li>It makes the output stream work faster because not every write request
is communicated to the server.</li>
</ul>
<p>Use the <a href="javadoc/com/ibm/as400/access/SpooledFileOutputStream.html#FLUSH()"> flush()</a> method to force the data to be written to the
server.</p>
<p>When the caller is finished writing data to the new spooled
file, the <a href="javadoc/com/ibm/as400/access/SpooledFileOutputStream.html#CLOSE()"> close()</a> method is called to close the spooled file.
Once the spooled file has been closed, no more data can be written to it.
By calling the <a href="javadoc/com/ibm/as400/access/SpooledFileOutputStream.html#GETSPOOLEDFILE()"> getSpooledFile()</a> method once the spooled file has been
closed, the caller can get a reference to a SpooledFile object that represents
the spooled file.</p>
</div>
<div class="section" id="printsf__datastreamtypes"><a name="printsf__datastreamtypes"><!-- --></a><h4 class="sectiontitle">Data stream types in spooled files</h4><p>Use
the Printer Data Type attribute of the spooled file to set the type of data
to be put into the spooled file. If the caller does not specify a printer
data type, the default is to use automatic data typing. This method looks
at the first few thousand bytes of the spooled file data, determines if it
fits either SNA Character Stream (SCS) or Advanced Function Printing™ data
stream (AFPDS) data stream architectures, and then sets the attribute appropriately.
If the bytes of spooled file data do not match either of these architectures,
the data is tagged as *USERASCII. Automatic data typing works most of the
time. The caller generally uses it unless the caller has a specific case in
which automatic data typing does not work. In those cases, the caller can
set the Printer Data Type attribute to a specific value (for example, *SCS).
If the caller wants to use the printer data that is in the printer file, the
caller must use the special value *PRTF. If the caller overrides the default
data type when creating a spooled file, caution must be used to ensure that
the data put into the spooled file matches the data type attribute. Putting
non-SCS data into a spooled file that is marked to receive SCS data triggers
an error message from the host and the loss of the spooled file.</p>
<p>Generally,
this attribute can have three values:</p>
<ul><li><strong>*SCS</strong> - an EBCDIC, text-based printer data stream.</li>
<li><strong>*AFPDS</strong> (Advanced Function Presentation™ Data
Stream) - another data stream supported on the server. *AFPDS can contain
text, image, and graphics, and can use external resources such as page overlays
and external images in page segments.</li>
<li><strong>*USERASCII</strong> - any non-SCS and non-AFPDS printer data that the server
handles by just passing it through. Postscript and HP-PCL data streams are
examples data streams that are in a *USERASCII spooled file.</li>
</ul>
</div>
<div class="section"><h4 class="sectiontitle">Examples</h4><p>The following examples show ways you can
work with spooled files. The first example shows how to create a spooled file
on a server from an input stream. The second example shows how to generate
an SCS data stream using the SCS3812Writer class, and how to write the stream
to a spooled file on the server.</p>
<blockquote><p><a href="npexamplecreatesplf.htm#npexamplecreatesplf">Example: Creating spooled files</a></p>
<p><a href="npexamplecreatescssplf.htm#npexamplecreatescssplf">Example: Creating SCS spooled files</a></p>
</blockquote>
</div>
</div>
</body>
</html>