119 lines
4.5 KiB
HTML
119 lines
4.5 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="Example: Listing spooled files synchronously" />
|
|
<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="npexamplelistsplfsynch" />
|
|
<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: Listing spooled files synchronously</title>
|
|
</head>
|
|
<body id="npexamplelistsplfsynch"><a name="npexamplelistsplfsynch"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Listing spooled files synchronously</h1>
|
|
<div><p></p>
|
|
<div class="section"><div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm#codedisclaimer">Code
|
|
example disclaimer</a> for important legal information.</div>
|
|
<pre>/////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Example that shows listing all spooled files on a server synchronously.
|
|
// Listing synchronously does not return to the caller until the complete list
|
|
// is built. The user perceives a slower response time then listing asynchronously.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// This source is an example of IBM Toolbox for Java "PrintObjectList".
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
import java.util.Enumeration;
|
|
|
|
import com.ibm.as400.access.AS400;
|
|
import com.ibm.as400.access.SpooledFileList;
|
|
import com.ibm.as400.access.SpooledFile;
|
|
|
|
public class NPExampleListSplfSynch
|
|
{
|
|
private AS400 system_ = new AS400();
|
|
|
|
public NPExampleListSplfSynch(AS400 system)
|
|
{
|
|
system_ = system;
|
|
}
|
|
|
|
public void listSpooledFiles()
|
|
{
|
|
try{
|
|
String strSpooledFileName;
|
|
|
|
if( system_ == null )
|
|
{
|
|
system_ = new AS400();
|
|
}
|
|
|
|
System.out.println(" Now receiving all spooled files Synchronously");
|
|
|
|
SpooledFileList splfList = new SpooledFileList( system_ );
|
|
|
|
// set filters, all users, on all queues
|
|
splfList.setUserFilter("*ALL");
|
|
splfList.setQueueFilter("/QSYS.LIB/%ALL%.LIB/%ALL%.OUTQ");
|
|
|
|
// open list, openSynchronously() returns when the list is completed.
|
|
splfList.openSynchronously();
|
|
Enumeration enum = splfList.getObjects();
|
|
|
|
while( enum.hasMoreElements() )
|
|
{
|
|
SpooledFile splf = (SpooledFile)enum.nextElement();
|
|
if ( splf != null )
|
|
{
|
|
// output this spooled file's name
|
|
strSpooledFileName = splf.getStringAttribute(SpooledFile.ATTR_SPOOLFILE);
|
|
System.out.println(" spooled file = " + strSpooledFileName);
|
|
}
|
|
}
|
|
// clean up after we are done with the list
|
|
splfList.close();
|
|
}
|
|
catch( Exception e )
|
|
{
|
|
// ...handle any exceptions...
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public static void main( String args[] )
|
|
{
|
|
NPExampleListSplfSynch list = new NPExampleListSplfSynch(new AS400());
|
|
try{
|
|
list.listSpooledFiles();
|
|
}
|
|
catch( Exception e )
|
|
{
|
|
e.printStackTrace();
|
|
}
|
|
System.exit(0);
|
|
}
|
|
}</pre>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |