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

69 lines
4.7 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="EnvironmentVariable class" />
<meta name="abstract" content="The EnvironmentVariable class and the EnvironmentVariableList class enable you to access and set iSeries system-level environment variables." />
<meta name="description" content="The EnvironmentVariable class and the EnvironmentVariableList class enable you to access and set iSeries system-level environment variables." />
<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="environmentvariable" />
<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>EnvironmentVariable class</title>
</head>
<body id="environmentvariable"><a name="environmentvariable"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">EnvironmentVariable class</h1>
<div><p>The EnvironmentVariable class and the EnvironmentVariableList class
enable you to access and set iSeries™ system-level environment variables.</p>
<div class="section"><p><a href="javadoc/com/ibm/as400/access/EnvironmentVariable.html#NAVBAR_TOP"> EnvironmentVariable class</a> </p>
<p><a href="javadoc/com/ibm/as400/access/EnvironmentVariableList.html#NAVBAR_TOP"> EnvironmentVariableList class</a> </p>
<p>Each variable has
unique identifiers: the system name and the environment variable name. Each
environment variable is associated with a CCSID, which is by default the CCSID
of the current job, which describes where the contents of the variable are
stored.</p>
<div class="note"><span class="notetitle">Note:</span> Environment variables are different than system values,
although they are often used for the same purpose. See <a href="sysval.htm#sysval">SystemValues</a> for
more information on how to access system values.</div>
<p>Use an EnvironmentVariable
object to perform the following actions on an environment variable:</p>
<ul><li><a href="javadoc/com/ibm/as400/access/EnvironmentVariable.html#GETNAME(INT)"> Get</a> and <a href="javadoc/com/ibm/as400/access/EnvironmentVariable.html#SETNAME(JAVA.LANG.STRING)"> set</a> the name</li>
<li><a href="javadoc/com/ibm/as400/access/EnvironmentVariable.html#GETSYSTEM()">Get</a> and <a href="javadoc/com/ibm/as400/access/EnvironmentVariable.html#SETSYSTEM(COM.IBM.AS400.ACCESS.AS400)"> set</a> the system</li>
<li><a href="javadoc/com/ibm/as400/access/EnvironmentVariable.html#GETVALUE()"> Get</a> and <a href="javadoc/com/ibm/as400/access/EnvironmentVariable.html#SETVALUE(JAVA.LANG.STRING, INT)"> set</a> the value (which allows you to change the CCSID)</li>
<li><a href="javadoc/com/ibm/as400/access/EnvironmentVariable.html#REFRESHVALUE()"> Refresh</a> the value</li>
</ul>
</div>
<div class="section" id="environmentvariable__envvarex"><a name="environmentvariable__envvarex"><!-- --></a><h4 class="sectiontitle">Example: Creating, setting, and getting environment
variables</h4><div class="p">The following example creates two EnvironmentVariables
and sets and gets their values.<div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm#codedisclaimer">Code
example disclaimer</a> for important legal information.</div>
</div>
<pre> // Create the iSeries system object.
AS400 system = new AS400("mySystem");
// Create the foreground color environment variable and set it to red.
EnvironmentVariable fg = new EnvironmentVariable(system, "FOREGROUND");
fg.setValue("RED");
// Create the background color environment variable and get its value.
EnvironmentVariable bg = new EnvironmentVariable(system, "BACKGROUND");
String background = bg.getValue();</pre>
</div>
</div>
</body>
</html>