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

134 lines
7.3 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="Copying 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="printcopy" />
<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>Copying spooled files</title>
</head>
<body id="printcopy"><a name="printcopy"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Copying spooled files</h1>
<div><p></p>
<div class="section"><p>You can use the <a href="javadoc/com/ibm/as400/access/SpooledFile.html#COPY()">copy method of the SpooledFile class</a> to create a copy
of the spooled file that the SpooledFile object represents. Using SpooledFile.copy()
performs the following actions:</p>
<ul><li>Creates the new spooled file on the same output queue and on the same
system as the original spooled file</li>
<li>Returns a reference to the new spooled file</li>
</ul>
<p>SpooledFile.copy() is a new method available to you only if you download
JTOpen 3.2 or later or apply an i5/OS™ fix. It is recommended that the better
solution is to download and use JTOpen. For more information, see the following:</p>
<blockquote><a href="http://www.ibm.com/servers/eserver/iseries/toolbox/downloads.htm" target="_blank">IBM<sup>®</sup> Toolbox for Java™ and JTOpen: Downloads</a> <img src="www.gif" alt="Link outside information center" /></blockquote>
<blockquote><a href="http://www.ibm.com/servers/eserver/iseries/toolbox/servicepacks.htm" target="_blank">IBM Toolbox for Java and JTOpen: Service Packs</a> <img src="www.gif" alt="Link outside information center" /></blockquote>
<p>The
copy method uses the Create Spooled File (QSPCRTSP) API within the network
print server job to create an exact replica of the spooled file. You need
only a unique creation date and time to preserve the identity of the newly
created copy of the spooled file. For more information about the QSPCRTSP
API, see the following information:</p>
<blockquote><a href="../apis/QSPCRTSP.htm">Create Spooled File (QSPCRTSP) API</a></blockquote>
<p>Specifying
an output queue as a parameter to the copy method creates the copy of the
spooled file to the first position on the specified output queue. Both the
output queue and the original spooled file must reside on the same system</p>
</div>
<div class="section" id="printcopy__copyspooledfile"><a name="printcopy__copyspooledfile"><!-- --></a><h4 class="sectiontitle">Example: Copying a spooled file using
SpooledFile.copy()</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>This example
shows how to use SpooledFile.copy() to copy a spooled file to the same queue
that contains the file you want to copy. When you want to route the newly
copied spooled file to a specific output queue, pass the output queue as
a parameter to the copy method:</p>
<pre> SpooledFile newSplf = new sourceSpooledFile.copy(&lt;outqname&gt;);</pre>
<p> where &lt;outqname&gt;
is the OutputQueue object.</p>
<pre> public static void main(String args[]) {
// Create the system object
AS400 as400 = new AS400(&lt;systemname&gt;,&lt;username&gt;, &lt;password&gt;);
// Identify the output queue that contains the spooled file you want to copy.
OutputQueue outputQueue =
new OutputQueue(as400, "/QSYS.LIB/QUSRSYS.LIB/&lt;outqname&gt;.OUTQ");
// Create an array that contains all the elements required to
// uniquely identify a spooled file on the iSeries server.
String[][] splfTags = { {
&lt;spoolfilename&gt;,
&lt;spoolfilenum&gt;,
&lt;jobname&gt;,
&lt;username&gt;,
&lt;jobnumber&gt;,
// Note that &lt;systemname&gt;,&lt;date&gt;, and &lt;time&gt; are optional.
// If you do not include them, remove the corresponding
// splfTags[i],[j], where j has the value of 5,6, or 7.
&lt;systemname&gt;,
&lt;date&gt;,
&lt;time&gt;},
};
// Print the information that identifies the spooled file to System.out
for ( int i=0; i&lt;splfTags.length; i++) {
System.out.println("Copying -&gt; " + splfTags[i][0] + ","
+ splfTags[i][1] + ","
+ splfTags[i][2] + ","
+ splfTags[i][3] + ","
+ splfTags[i][4] + ","
+ splfTags[i][5] + ","
+ splfTags[i][6] + ","
+ splfTags[i][7] );
// Create the SpooledFile object for the source spooled file.
SpooledFile sourceSpooledFile =
new SpooledFile(as400,
splfTags[i][0],
Integer.parseInt(splfTags[i][1]),
splfTags[i][2],
splfTags[i][3],
splfTags[i][5],
splfTags[i][6],
splfTags[i][7] );
}
// Copy the spooled file, which creates a new SpooledFile object.
// To route the copy of the spooled file to a specific output queue,
// use the following code:
// SpooledFile newSplf = new sourceSpooledFile.copy(&lt;outqname&gt;);
// where &lt;outqname&gt; is an OutputQueue object. Specify the output
// queue in the following way:
// OutputQueue outputQueue =
// new OutputQueue(as400, "/QSYS.LIB/QUSRSYS.LIB/&lt;outqname&gt;.OUTQ");
try { SpooledFile newSplf = new sourceSpooledFile.copy();
}
catch ( Exception e){
}</pre>
</div>
<div class="section"><h4 class="sectiontitle">Javadoc reference documentation</h4><p>For more information
about SpooledFile.copy(), see the following Javadoc reference documentation:</p>
<blockquote><a href="javadoc/com/ibm/as400/access/SpooledFile.html#COPY()">The
SpooledFile copy() method</a></blockquote>
</div>
</div>
</body>
</html>