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

89 lines
4.4 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="Examples: Resource list" />
<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="resourceexamples" />
<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>Examples: Resource list</title>
</head>
<body id="resourceexamples"><a name="resourceexamples"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Examples: Resource list</h1>
<div><p></p>
<div class="section"><p>The following examples show various ways of working with resource
lists:</p>
<ul><li>Example: Getting and printing the contents of a ResourceList</li>
<li>Example: <a href="resourcegeneric.htm#resourcegeneric">Using generic
code to access a ResourceList</a></li>
<li>Example: <a href="resourcepresentlist.htm#resourcepresentlist">Presenting
a resource list in a servlet</a></li>
</ul>
</div>
<div class="section"><h4 class="sectiontitle">Example: Getting and printing the contents of a ResourceList</h4><p>One
example of a concrete subclass of ResourceList is <a href="javadoc/com/ibm/as400/resource/RJobList.html#NAVBAR_TOP"> com.ibm.as400.resource.RJobList</a>, which represents a
list of iSeries™ jobs.
RJobList supports many <a href="javadoc/com/ibm/as400/resource/RJobList.html#SELECTIONIDS"> selection IDs</a> and <a href="javadoc/com/ibm/as400/resource/RJobList.html#SORTIDS">sort IDs</a>, each of which can be used to filter or sort
the list.This example prints the contents of an RJobList:</p>
<div class="p"><pre> // Create an RJobList object to represent a list of jobs.
AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
RJobList jobList = new RJobList(system);
// Filter the list to include only interactive jobs.
jobList.setSelectionValue(RJobList.JOB_TYPE, RJob.JOB_TYPE_INTERACTIVE);
// Sort the list by user name, then job name.
Object[] sortValue = new Object[] { RJob.USER_NAME, RJob.JOB_NAME };
jobList.setSortValue(sortValue);
// Open the list and wait for it to complete.
jobList.open();
jobList.waitForComplete();
// Read and print the contents of the list.
long length = jobList.getListLength();
for(long i = 0; i &lt; length; ++i)
{
System.out.println(jobList.resourceAt(i));
}
// Close the list.
jobList.close();</pre>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Code example disclaimer</h4><p>The following disclaimer
applies to all of the IBM<sup>®</sup> Toolbox for Java™ examples:</p>
<blockquote> <p>IBM grants you
a nonexclusive copyright license to use all programming code examples from
which you can generate similar function tailored to your own specific needs.</p>
<p>All
sample code is provided by IBM for illustrative purposes only. These examples have
not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply
reliability, serviceability, or function of these programs.</p>
<p>All programs
contained herein are provided to you "AS IS" without any warranties of any
kind. The implied warranties of non-infringement, merchantability and fitness
for a particular purpose are expressly disclaimed.</p>
</blockquote>
</div>
</div>
</body>
</html>