152 lines
8.6 KiB
HTML
152 lines
8.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="System values" />
|
||
|
<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="sysval" />
|
||
|
<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>System values</title>
|
||
|
</head>
|
||
|
<body id="sysval"><a name="sysval"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">System values</h1>
|
||
|
<div><p></p>
|
||
|
<div class="section"><p>The <a href="javadoc/com/ibm/as400/access/SystemValue.html">system value</a> classes allow a Java™ program to retrieve and change system
|
||
|
values and network attributes. You can also define your own <a href="javadoc/com/ibm/as400/access/SystemValueGroup.html">group</a> to
|
||
|
contain the system values you want.</p>
|
||
|
<p>A SystemValue object primarily contains
|
||
|
the following information:</p>
|
||
|
<ul><li><a href="javadoc/com/ibm/as400/access/SystemValue.html#GETNAME()">Name</a></li>
|
||
|
<li><a href="javadoc/com/ibm/as400/access/SystemValue.html#GETDESCRIPTION()">Description</a></li>
|
||
|
<li><a href="javadoc/com/ibm/as400/access/SystemValue.html#GETRELEASE()">Release</a></li>
|
||
|
<li> <a href="javadoc/com/ibm/as400/access/SystemValue.html#GETVALUE()">Value</a></li>
|
||
|
</ul>
|
||
|
<p>Using the SystemValue class, retrieve a single system value by using
|
||
|
the <a href="javadoc/com/ibm/as400/access/SystemValue.html#GETVALUE()"> getValue()</a> method and change a system value by using
|
||
|
the <a href="javadoc/com/ibm/as400/access/SystemValue.html#SETVALUE(JAVA.LANG.OBJECT)"> setValue()</a> method.</p>
|
||
|
<p>You can also retrieve group
|
||
|
information about a particular system value:</p>
|
||
|
<ul><li>To retrieve the system-defined group to which a system value belongs,
|
||
|
use the <a href="javadoc/com/ibm/as400/access/SystemValue.html#GETGROUP()"> getGroup()</a> method.</li>
|
||
|
<li>To retrieve the user-defined group to which a SystemValue object belongs
|
||
|
(if any), use the <a href="javadoc/com/ibm/as400/access/SystemValue.html#GETGROUPNAME()"> getGroupName()</a> and <a href="javadoc/com/ibm/as400/access/SystemValue.html#GETGROUPDESCRIPTION()"> getGroupDescription()</a> methods.</li>
|
||
|
</ul>
|
||
|
<p>Whenever the value of a system value is retrieved for the first time,
|
||
|
the value is retrieved from the iSeries™ and cached. On subsequent retrievals,
|
||
|
the cached value is returned. If the current iSeries value is what you want instead
|
||
|
of the cached value, a <a href="javadoc/com/ibm/as400/access/SystemValue.html#CLEAR()">clear()</a> must be done to clear the current cache.</p>
|
||
|
</div>
|
||
|
<div class="section"><h4 class="sectiontitle">System value list</h4><p><a href="javadoc/com/ibm/as400/access/SystemValueList.html">SystemValueList</a> represents a list of system values on
|
||
|
the specified iSeries server.
|
||
|
The list is divided into several <a href="javadoc/com/ibm/as400/access/SystemValueList.html#FIELD_SUMMARY"> system-defined groups</a> that allow the Java program
|
||
|
to access a portion of the system values at a time.</p>
|
||
|
</div>
|
||
|
<div class="section"><p><strong><span class="synph" id="sysval__systemvaluegroup"><a name="sysval__systemvaluegroup"><!-- --></a><span class="kwd"></span></span>System value
|
||
|
group</strong></p>
|
||
|
<p><a href="javadoc/com/ibm/as400/access/SystemValueGroup.html">SystemValueGroup</a> represents a user-defined collection
|
||
|
of system values and network attributes. Rather than a container, it is instead
|
||
|
a factory for generating and maintaining unique collections of system values.</p>
|
||
|
<p>You
|
||
|
can create a SystemValueGroup by specifying one of the system-defined groups
|
||
|
(one of the constants in the SystemValueList class) or by specifying an array
|
||
|
of system value names.</p>
|
||
|
<p>You can individually add the names of system
|
||
|
values to include in the group by using the <a href="javadoc/com/ibm/as400/access/SystemValueGroup.html#ADD(JAVA.LANG.STRING)"> add()</a> method. You can also remove them by using the <a href="javadoc/com/ibm/as400/access/SystemValueGroup.html#REMOVE(JAVA.LANG.STRING)"> remove()</a> method.</p>
|
||
|
<p>Once the SystemValueGroup is
|
||
|
populated with the required system value names, obtain the real SystemValue
|
||
|
objects from the group by calling the <a href="javadoc/com/ibm/as400/access/SystemValueGroup.html#GETSYSTEMVALUES()"> getSystemValues()</a> method. In this way, a SystemValueGroup
|
||
|
object takes a set of system value names and generates a Vector of SystemValue
|
||
|
objects, all having the system, group name, and group description of the SystemValueGroup.</p>
|
||
|
<p>To
|
||
|
refresh a Vector of SystemValue objects all at once, use the <a href="javadoc/com/ibm/as400/access/SystemValueGroup.html#REFRESH(JAVA.UTIL.VECTOR)"> refresh()</a> method. </p>
|
||
|
</div>
|
||
|
<div class="section"><h4 class="sectiontitle">Examples of using the SystemValue and SystemValueList classes</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 how to create
|
||
|
and retrieve a system value:</p>
|
||
|
</div>
|
||
|
<div class="section"><div class="p"><pre>//Create an AS400 object
|
||
|
AS400 sys = new AS400("mySystem.myCompany.com");
|
||
|
|
||
|
//Create a system value representing the current second on the system.
|
||
|
SystemValue sysval = new SystemValue(sys, "QSECOND");
|
||
|
|
||
|
//Retrieve the value.
|
||
|
String second = (String)sysval.getValue();
|
||
|
|
||
|
//At this point QSECOND is cached. Clear the cache to retrieve the most
|
||
|
//up-to-date value from the system.
|
||
|
sysval.clear();
|
||
|
second = (String)sysval.getValue();
|
||
|
|
||
|
//Create a system value list.
|
||
|
SystemValueList list = new SystemValueList(sys);
|
||
|
|
||
|
//Retrieve all the of the date/time system values.
|
||
|
Vector vec = list.getGroup(SystemValueList.GROUP_DATTIM);
|
||
|
|
||
|
//Disconnect from the system.
|
||
|
sys.disconnectAllServices();</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section"><strong><span class="synph" id="sysval__sysvalexample2"><a name="sysval__sysvalexample2"><!-- --></a><span class="kwd"></span></span>Examples of using
|
||
|
the SystemValueGroup class</strong><p>The following example shows how to build
|
||
|
a group of system value names and then manipulate them:</p>
|
||
|
<div class="p"><pre>//Create an AS400 object
|
||
|
AS400 sys = new AS400("mySystem.myCompany.com");
|
||
|
|
||
|
//Create a system value group initially representing all of the network attributes on the system.
|
||
|
String name = "My Group";
|
||
|
String description = "This is one of my system values.";
|
||
|
SystemValueGroup svGroup = new SystemValueGroup(sys, name, description, SystemValueList.GROUP_NET);
|
||
|
|
||
|
//Add some more system value names to the group and remove some we do not want.
|
||
|
svGroup.add("QDATE");
|
||
|
svGroup.add("QTIME");
|
||
|
svGroup.remove("NETSERVER");
|
||
|
svGroup.remove("SYSNAME");
|
||
|
|
||
|
//Obtain the actual SystemValue objects. They are returned inside a Vector.
|
||
|
Vector sysvals = svGroup.getSystemValues();
|
||
|
|
||
|
//You will notice that this is one of my system values.
|
||
|
SystemValue mySystemValue = (SystemValue)sysvals.elementAt(0);
|
||
|
System.out.println(mySystemValue.getName()+" - "+mySystemValue.getGroupDescription());
|
||
|
|
||
|
//We can add another SystemValue object from another system into the group.
|
||
|
AS400 sys2 = new AS400("otherSystem.myCompany.com");
|
||
|
SystemValue sv = new SystemValue(sys2, "QDATE");
|
||
|
sysvals.addElement(sv);
|
||
|
|
||
|
//Now refresh the entire group of system values all at once.
|
||
|
//It does not matter if some system values are from different iSeries servers.
|
||
|
//It does not matter if some system values were generated using SystemValueGroup and some were not.
|
||
|
SystemValueGroup.refresh(sysvals);
|
||
|
|
||
|
//Disconnect from the systems.
|
||
|
sys.disconnectAllServices();
|
||
|
sys2.disconnectAllServices();</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</body>
|
||
|
</html>
|