1<html><head>
2      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3   <title>Frequently Asked Questions About STAF V3, STAX, and STAF Services</title><meta name="generator" content="DocBook XSL Stylesheets V1.64.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="d0e1"></a>Frequently Asked Questions About STAF V3, STAX, and STAF Services</h2></div></div><div></div><hr></div><p>
4This is where you should look if you have a question about STAF V3, STAX V3, or an
5external STAF V3 service.
6</p><p>
7For questions about STAF V2, STAX V1, or an external STAF V2 service,.
8see the <a href="http://staf.sourceforge.net/current2x/STAFFAQ.htm" target="_top">STAF V2 FAQ</a>
9</p><div class="qandaset"><dl><dt>1.  <a href="#d0e14">General Information</a></dt><dd><dl><dt>1.1. <a href="#d0e17">What is STAF?</a></dt><dt>1.2. <a href="#d0e36">What operating systems are supported by STAF?</a></dt><dt>1.3. <a href="#d0e98">Where can I get STAF?</a></dt><dt>1.4. <a href="#d0e109">Is STAF Open Source?</a></dt><dt>1.5. <a href="#d0e130">What documentation exists for STAF V3?</a></dt><dt>1.6. <a href="#d0e181">How do I get on/off STAF mailing lists?</a></dt><dt>1.7. <a href="#d0e192">How do I get help?</a></dt><dt>1.8. <a href="#d0e235">How do I request a feature for STAF?</a></dt><dt>1.9. <a href="#d0e246">Why isn't STAF written in Java?</a></dt><dt>1.10. <a href="#d0e281">What is the performance overhead of running STAF?</a></dt><dt>1.11. <a href="#d0e289">How do I interact with STAF?</a></dt></dl></dd><dt>2.  <a href="#d0e304">How-to Questions</a></dt><dd><dl><dt>2.1.  <a href="#d0e307">Installation/Configuration</a></dt><dd><dl><dt>2.1.1. <a href="#d0e310">How do I install STAF?</a></dt><dt>2.1.2. <a href="#d0e318">How do I install STAF in silent mode?</a></dt><dt>2.1.3. <a href="#d0e347">How do I configure STAF?</a></dt><dt>2.1.4. <a href="#d0e355">How can I determine which version/architecture of STAF is installed?</a></dt></dl></dd><dt>2.2.  <a href="#d0e410">Starting STAF</a></dt><dd><dl><dt>2.2.1. <a href="#How do I load STAFEnv.sh automatically for each terminal window I open on Unix?">
10How do I load STAFEnv.sh automatically for each terminal window I open on Unix?
11</a></dt></dl></dd><dt>2.3.  <a href="#d0e436">PROCESS Service</a></dt><dd><dl><dt>2.3.1. <a href="#d0e439">How do I redirect output from a process started by STAF?</a></dt><dt>2.3.2. <a href="#d0e451">
12How do I run a complex command that I can type at a shell (command) prompt
13via STAF?
14</a></dt><dt>2.3.3. <a href="#d0e480">
15How do I quote options that contain white space (e.g. pathnames containing spaces, etc.) via STAF?
16</a></dt><dt>2.3.4. <a href="#d0e553">
17How do I use a static handle to have multiple programs access variables and
18log data?
19</a></dt><dt>2.3.5. <a href="#d0e566">
20How do I change the system date/time to a prior date/time via a PROCESS
21START request?
22</a></dt></dl></dd><dt>2.4.  <a href="#d0e608">LOG Service</a></dt><dd><dl><dt>2.4.1. <a href="#d0e611">How do I make each application have its own STAF log file?</a></dt><dt>2.4.2. <a href="#d0e648">
23How do I view a STAF log as it appears to be in some weird format?
24</a></dt></dl></dd><dt>2.5.  <a href="#d0e664">HTTP Service</a></dt><dd><dl><dt>2.5.1. <a href="#d0e667">
25Does the HTTP Service retain session information across multiple requests?
26</a></dt></dl></dd><dt>2.6.  <a href="#d0e675">STAX Service</a></dt><dd><dl><dt>2.6.1. <a href="#d0e678">
27How do I access system date and time in a STAX job?
28</a></dt><dt>2.6.2. <a href="#d0e690">
29How do I search for multiple strings in testcase output files in STAX?
30</a></dt><dt>2.6.3. <a href="#d0e714">
31How do I access STAF system variable values via a STAX job?
32</a></dt><dt>2.6.4. <a href="#d0e738">
33How do I use the &lt;stopusing&gt; element in a STAX job that runs on both
34Windows and Unix?
35</a></dt><dt>2.6.5. <a href="#d0e751">
36Does a STAX process element use the workdir element as the path to the command?
37</a></dt><dt>2.6.6. <a href="#d0e770">
38How do I use STAF and STAX to boot and shutdown VMWare images on my test machines?
39</a></dt><dt>2.6.7. <a href="#d0e782">
40How can I parse an XML file from a STAX job?
41</a></dt></dl></dd><dt>2.7.  <a href="#d0e794">Globalization</a></dt><dd><dl><dt>2.7.1. <a href="#d0e797">
42How do I use STAF/STAX in environments where machines running STAF have
43different locales?
44</a></dt><dt>2.7.2. <a href="#d0e814">
45How do I specify non-ASCII characters in a STAF request or STAX job?
46</a></dt><dt>2.7.3. <a href="#d0e855">
47How do I know what codepage STAF is using on my machine?
48</a></dt></dl></dd></dl></dd><dt>3.  <a href="#d0e869">Debugging STAF</a></dt><dd><dl><dt>3.1.  <a href="#d0e872">General Questions</a></dt><dd><dl><dt>3.1.1. <a href="#d0e875">
49What should I do if I'm having a problem with STAF or one of its services?
50</a></dt><dt>3.1.2. <a href="#d0e904">What information should I include when asking questions or reporting bugs?</a></dt><dt>3.1.3. <a href="#d0e934">
51Explain RC 16 when attempting to send a STAF request to a remote machine
52</a></dt><dt>3.1.4. <a href="#STAF machines can't communicate due to DNS issues">
53Why can't my STAF machines communicate?
54</a></dt><dt>3.1.5. <a href="#d0e1132">
55Why aren't my entries in /etc/hosts being used for STAF communication (particularly on Linux SLES)?
56</a></dt><dt>3.1.6. <a href="#d0e1151">
57Why can't I use the HELP service when STAF is not running?
58</a></dt><dt>3.1.7. <a href="#d0e1167">
59Why are there are more STAF processes on Linux?
60</a></dt><dt>3.1.8. <a href="#d0e1183">
61Why am I having problems (such as an RC 6) submitting a request to a Java service?
62</a></dt><dt>3.1.9. <a href="#d0e1202">
63Why is STAFProc terminating on some Unix platforms (such as Solaris)
64when the STAFProc terminal is exited?
65</a></dt><dt>3.1.10. <a href="#d0e1229">
66Why don't I see any Java service output in the STAFProc console anymore?
67</a></dt><dt>3.1.11. <a href="#d0e1257">
68When using Sun Java 1.4.2, why are the -Xmx settings for my Java STAF service
69not being used?
70</a></dt><dt>3.1.12. <a href="#d0e1267">
71Explain RC 21 when running staf local ping ping on
72Unix platforms.
73</a></dt><dt>3.1.13. <a href="#Error accepting on server socket, socket RC: 24">Explain "Error accepting on server socket,socket RC: 24"</a></dt><dt>3.1.14. <a href="#Error using STAF Java libraries on Linux: libJSTAF.so: undefined symbol: _ZNSt8ios_base4InitD1Ev">Explain error using STAF Java libraries on Linux: libJSTAF.so: undefined symbol: _ZNSt8ios_base4InitD1Ev"</a></dt><dt>3.1.15. <a href="#Slow performance sending a STAF PING request to a remote machine">Why is the performance slow when sending a STAF PING request to a remote machine?</a></dt><dt>3.1.16. <a href="#Why does a request to the LOG, MONITOR, RESPOOL, or ZIP service fail with RC 2 (Unknown service)">Why does a request to the LOG, MONITOR, RESPOOL, or ZIP service fail with RC 2 (Unknown service)?</a></dt></dl></dd><dt>3.2.  <a href="#d0e1368">STAF Install Questions</a></dt><dd><dl><dt>3.2.1. <a href="#d0e1371">
74If the InstallAnywhere installer fails, how do I get debug information?
75</a></dt><dt>3.2.2. <a href="#d0e1381">What if AIX STAF environment variables (PATH, LIBPATH, etc.) are not set when opening a terminal?</a></dt><dt>3.2.3. <a href="#d0e1393">
76When running STAFInst on Solaris, why does it fail with "test: unknown
77operator -ef"?
78</a></dt><dt>3.2.4. <a href="#d0e1410">
79Explain message "JAR Archive failed security check corrupt JAR file" when
80trying to download a STAF jar file
81</a></dt><dt>3.2.5. <a href="#d0e1418">
82Why does the STAF InstallAnywhere install fail on RHEL5?
83</a></dt><dt>3.2.6. <a href="#d0e1431">
84What entries do I need for STAF in my /etc/profile file if I am using the
85STAF tar.gz installation?
86</a></dt></dl></dd><dt>3.3.  <a href="#d0e1442">STAF Startup Questions</a></dt><dd><dl><dt>3.3.1. <a href="#d0e1445">Explain startup error: Error constructing service, JSTAF</a></dt><dt>3.3.2. <a href="#d0e1479">Explain startup error: Error binding server socket, bind() RC=98 (or 67)</a></dt><dt>3.3.3. <a href="#d0e1550">Explain startup error: Error binding server socket, bind() RC=10048</a></dt><dt>3.3.4. <a href="#d0e1573">
87Explain startup error: 38:Illegal access to class: com.ibm.staf.service....
88</a></dt><dt>3.3.5. <a href="#d0e1583">
89Why does STAF's user registration fail each time STAFProc is started?
90</a></dt><dt>3.3.6. <a href="#d0e1591">
91Explain startup error:  Error initializing service, RESPOOL. RC: 4008
92</a></dt><dt>3.3.7. <a href="#d0e1601">What should I do if STAF fails to init with Windows Terminal Server?</a></dt><dt>3.3.8. <a href="#d0e1611">
93On SLES8, why do I get an error starting STAF: STAFProc:
94/usr/lib/libstdc++.so.5: version `GLIBCPP_3.2.2' not found (required by
95STAFProc)
96</a></dt><dt>3.3.9. <a href="#d0e1619">
97Explain startup error on z/OS: Error binding server socket, bind() RC=1115
98</a></dt><dt>3.3.10. <a href="#d0e1629">Explain startup error: RC: 27, Error initializing service, JSTAF when using a
99GNU compiler for Java provided with Linux</a></dt><dt>3.3.11. <a href="#d0e1643">Explain HPUX error "sh: SHLIB_PATH: Parameter not set." when running
100/usr/local/staf/STAFEnv.sh, or when running it via sourcing .profile)</a></dt><dt>3.3.12. <a href="#d0e1651">When logged into the desktop on RHEL4-U4, if I run "STAFProc" or
101"STAF", I get "error while loading shared libraries: libSTAF.so".</a></dt><dt>3.3.13. <a href="#d0e1669">Explain AIX error "Symbol XX__Q2_3std8ios_base is not exported from
102dependent module /usr/lib/libC.a"</a></dt><dt>3.3.14. <a href="#d0e1694">
103Explain HPUX IA64 error /usr/lib/hpux32/dld.so: Unsatisfied code symbol
104'__cxa_get_exception_ptr' in load module './STAFProc'.
105</a></dt><dt>3.3.15. <a href="#d0e1716">
106On Windows x86_64), explain error OS RC 14001: This application has failed to start
107because the application configuration is incorrect..
108</a></dt><dt>3.3.16. <a href="#d0e1735">
109Explain Linux error "STAFProc: relocation error: undefined
110symbol: _ZNSs4_Rep20_S_empty_rep_storageE" when starting STAFProc.
111</a></dt><dt>3.3.17. <a href="#d0e1768">
112Explain Solaris Sparc 64-bit error when starting STAFProc:
113"/usr/sfw/lib/libstdc++.so.6: wrong ELF class: ELFCLASS32".
114</a></dt><dt>3.3.18. <a href="#d0e1785">
115Explain startup error: Error creating interface.  Could not determine
116logical/physical identifier.
117</a></dt></dl></dd><dt>3.4.  <a href="#d0e1802">PROCESS Service Questions</a></dt><dd><dl><dt>3.4.1. <a href="#d0e1805">Explain RC 10 when attempting to run a process</a></dt><dt>3.4.2. <a href="#d0e1825">Explain RC 25 when starting a process on a remote machine</a></dt><dt>3.4.3. <a href="#d0e1840">Explain why I'm having a problem interacting with process queues for
118processes started via the command line</a></dt><dt>3.4.4. <a href="#d0e1902">Why are child processes not killed on Windows?</a></dt><dt>3.4.5. <a href="#d0e1916">
119Why can't a STAF process log its output to an AFS directory?
120</a></dt><dt>3.4.6. <a href="#d0e1924">
121Why do I get a SIGABRT after a STAF process has completed on HP-UX?
122</a></dt><dt>3.4.7. <a href="#d0e1940">
123Explain error message: "STAFProcessManager::processMonitorThread: Parent
124could not set child's pgid: 13"
125</a></dt><dt>3.4.8. <a href="#d0e1948">
126Explain Unix error message: STAFProcessManager::processMonitorThread: Could not
127start process (execve): 8
128</a></dt><dt>3.4.9. <a href="#d0e1956">
129When running the ftp executable for Windows via a PROCESS START request, why aren't I getting the remote server responses in stdout?
130</a></dt><dt>3.4.10. <a href="#d0e1982">Why do Expect scripts fail on Linux when STAFProc has been started
131during system reboot?</a></dt><dt>3.4.11. <a href="#d0e2017">Why is different output returned by some commands such as "reg query"
132when run using a win32 version of STAF on a Windows 64-bit system?</a></dt></dl></dd><dt>3.5.  <a href="#d0e2050">FS Service Questions</a></dt><dd><dl><dt>3.5.1. <a href="#d0e2053">Why does COPY FILE request fail when no TOMACHINE is specified?</a></dt><dt>3.5.2. <a href="#d0e2090">
133Why are my text files copied via the FS service not converted correctly
134between Windows and Unix?
135</a></dt><dt>3.5.3. <a href="#d0e2098">
136Why can't I copy a file that is larger then 4GB?
137</a></dt><dt>3.5.4. <a href="#d0e2111">
138Why does FS LIST COPYREQUESTS show a copy request in progress on the destination machine
139that has already failed with a RC 22?
140</a></dt></dl></dd></dl></dd><dt>4.  <a href="#d0e2145">Debugging STAX</a></dt><dd><dl><dt>4.1.  <a href="#d0e2148">General Questions</a></dt><dd><dl><dt>4.1.1. <a href="#d0e2151">
141Where can I find more information about Python?
142</a></dt><dt>4.1.2. <a href="#d0e2193">
143Why is STAX still showing a process as running, even though it has completed?
144</a></dt><dt>4.1.3. <a href="#d0e2206">
145Why am I getting RC=10 and STAFResult=8 when starting a Java process in a
146STAX job?
147</a></dt><dt>4.1.4. <a href="#d0e2219">
148Why does my eMail Service's SEND request resulting in RC 7 when quotes or
149double quotes are in the message?
150</a></dt><dt>4.1.5. <a href="#d0e2229">
151Why am I getting a java.lang.NullPointerException at org.python.core.ThreadState.entrRepr in my JVMLog.1 file?
152</a></dt><dt>4.1.6. <a href="#d0e2266">
153Why aren't changes to imported Python modules picked up in my STAX job?
154</a></dt><dt>4.1.7. <a href="#RC 21 submitting a STAX EXECUTE request">Explain "RC 21 submitting a STAX EXECUTE request"</a></dt><dt>4.1.8. <a href="#d0e2419">
155Why is the STAX JVM crashing with a java.lang.OutOfMemoryError
156logged in the STAX JVM log?
157</a></dt><dt>4.1.9. <a href="#d0e2460">
158Why is the STAX JVM's maximum heap size limited to ~2G on a 32-bit system?
159</a></dt></dl></dd><dt>4.2.  <a href="#d0e2494">STAX &lt;import&gt; Questions</a></dt><dd><dl><dt>4.2.1. <a href="#d0e2497">
160Why aren't the global &lt;script&gt; elements in the imported XML file
161executed when importing a STAX function from that file?
162</a></dt><dt>4.2.2. <a href="#d0e2509">
163Are there any conflict or efficiency concerns when doing nested file imports
164in a STAX job?
165</a></dt></dl></dd><dt>4.3.  <a href="#d0e2605">STAX Monitor Questions</a></dt><dd><dl><dt>4.3.1. <a href="#d0e2608">What does RC 2 mean when starting the STAX Job Monitor?</a></dt><dt>4.3.2. <a href="#d0e2616">What does RC 16 mean when starting the STAX Job Monitor?</a></dt><dt>4.3.3. <a href="#d0e2624">
166What does RC 2 mean when submitting a new job via the STAX Job Monitor?
167</a></dt><dt>4.3.4. <a href="#d0e2632">
168What does RC 16 mean when submitting a new job via the STAX Job Monitor?
169</a></dt><dt>4.3.5. <a href="#d0e2640">
170Why I'm I getting a java.util.zip.ZipException running "java -jar STAXMon.jar"?
171</a></dt><dt>4.3.6. <a href="#d0e2654">
172Why doesn't the STAX Job Monitor window have a close confirmation?
173</a></dt></dl></dd></dl></dd></dl><table border="0" summary="Q and A Set"><col align="left" width="1%"><tbody><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e14"></a><h3 class="title"><a name="d0e14"></a>1. General Information</h3></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>1.1. <a href="#d0e17">What is STAF?</a></dt><dt>1.2. <a href="#d0e36">What operating systems are supported by STAF?</a></dt><dt>1.3. <a href="#d0e98">Where can I get STAF?</a></dt><dt>1.4. <a href="#d0e109">Is STAF Open Source?</a></dt><dt>1.5. <a href="#d0e130">What documentation exists for STAF V3?</a></dt><dt>1.6. <a href="#d0e181">How do I get on/off STAF mailing lists?</a></dt><dt>1.7. <a href="#d0e192">How do I get help?</a></dt><dt>1.8. <a href="#d0e235">How do I request a feature for STAF?</a></dt><dt>1.9. <a href="#d0e246">Why isn't STAF written in Java?</a></dt><dt>1.10. <a href="#d0e281">What is the performance overhead of running STAF?</a></dt><dt>1.11. <a href="#d0e289">How do I interact with STAF?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e17"></a><a name="d0e18"></a><b>1.1.</b></td><td align="left" valign="top"><p>What is STAF?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
174STAF stands for "Software Testing Automation Framework. As its name
175indicates, STAF is an automation framework. It is intended to make it easier
176to create and manage automated testcases and test environments.
177</p><p>
178STAF externalizes its capabilities through services. A service provides
179a focused set of functionality, such as, Logging, Process Invocation, etc.
180STAFProc is the process that runs on a machine, called a STAF Client, which
181accepts requests and routes them to the appropriate service. These requests
182may come from the local machine or from another STAF Client. Thus, STAF
183works in a peer environment, where machines may make requests of services
184on other machines.
185</p><p>STAF was designed with the following points in mind:
186</p><div class="itemizedlist"><ul type="disc"><li>
187Minimum machine requirements - This is both a hardware and a software statement.
188</li><li>
189Easily useable from a variety of languages, such as Java, C/C++, Rexx, Perl,
190and Tcl, or from a shell (command) prompt.
191</li><li>
192Easily extendable - This means that it should be easy to create other services
193to plug into STAF.
194</li></ul></div><p>
195</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e36"></a><a name="d0e37"></a><b>1.2.</b></td><td align="left" valign="top"><p>What operating systems are supported by STAF?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
196STAF 3.4.21+ is supported on the following operating systems:
197</p><div class="itemizedlist"><ul type="disc"><li>Windows 2000</li><li>Windows XP</li><li>Windows Server 2003 (i386, x86_64)</li><li>Windows Vista (i386, x86_64)</li><li>Windows Server 2008 (i386, x86_64)</li><li>Windows 7 (i386, x86_64)</li><li>Windows Server 2008 R2 (x86_64)</li><li>Windows 8 (i386, x86_64)</li><li>Windows Server 2012 (x86_64)</li><li>Linux (i386, x86_64, PPC64, PPC64LE)</li><li>Linux on zSeries (31-bit, 64-bit)</li><li>AIX 6.1 or higher (32-bit, 64-bit)</li><li>IBM i 7.1 and higher (32-bit, 64-bit), previously known as i5/OS or OS/400</li><li>z/OS UNIX V1.4 and higher (32-bit, 64-bit)</li><li>Mac OS X 10.10 and higher (Universal binary with support for i386 and x86_64)</li><li>Solaris (Sparc 32-bit) 10 and higher</li><li>Solaris (Sparc 64-bit) 10 and higher</li><li>Solaris (AMD Opteron 64-bit) 10 and higher</li><li>Solaris (x86) 10 and higher</li><li>HP-UX 11.11 and higher (PA-RISC) 32-bit and 64-bit</li><li>HP-UX 11.31 and higher (IA64) 32-bit and 64-bit</li><li>FreeBSD 7.4 and higher (i386)</li></ul></div><p>
198</p><p>
199If you need support for another operating system, open a feature request on the
200<a href="http://staf.sourceforge.net/index.php" target="_top">STAF SourceForge</a>
201web site.
202</p><p>
203</p><p>
204If you can't wait, port STAF to your favorite operating system yourself
205since STAF is open source.
206</p><p>
207</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e98"></a><a name="d0e99"></a><b>1.3.</b></td><td align="left" valign="top"><p>Where can I get STAF?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
208STAF software, information, documentation, etc. can be found at the
209<a href="http://staf.sourceforge.net" target="_top">STAF SourceForge</a> web site.
210</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e109"></a><a name="d0e110"></a><b>1.4.</b></td><td align="left" valign="top"><p>Is STAF Open Source?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
211Yes!  STAF is open source.  STAF Version 3.2.5 and later is licensed under the
212<a href="http://www.opensource.org/licenses/eclipse-1.0.php" target="_top">EPL (Eclipse Public License) V1.0</a>.
213</p><p>STAF Versions 2.6.8 through 3.2.4 were licensed under the
214<a href="http://www.opensource.org/licenses/cpl1.0.php" target="_top">Common Public License (CPL) V1.0</a>.
215</p><p>STAF Versions prior to 2.6.8 were licensed under the
216<a href="http://www.opensource.org/licenses/lgpl-2.1.php" target="_top">GNU Lesser General Public License (LGPL) V2.1</a>.
217</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e130"></a><a name="d0e131"></a><b>1.5.</b></td><td align="left" valign="top"><p>What documentation exists for STAF V3?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
218The following documents (and more) can be found at the
219<a href="http://staf.sourceforge.net/docs.php" target="_top">STAF/STAX V3 Documentation</a> web site:
220</p><div class="itemizedlist"><ul type="disc"><li><a href="http://staf.sourceforge.net/current/STAFGS.pdf" target="_top">Getting Started
221with STAF</a></li><li><a href="http://staf.sourceforge.net/current/STAFUG.htm" target="_top">STAF V3 User's Guide
222</a></li><li><a href="http://staf.sourceforge.net/current/STAFCMDS.htm" target="_top">STAF V3 Service
223Command Reference</a></li><li><a href="http://staf.sourceforge.net/current/STAFRC.htm" target="_top">STAF V3 API Return
224Codes</a></li><li><a href="http://staf.sourceforge.net/current/STAFJava.htm" target="_top">Java User's
225Guide for STAF V3</a></li><li><a href="http://staf.sourceforge.net/current/STAFPerl.htm" target="_top">Perl User's
226Guide for STAF V3</a></li><li><a href="http://staf.sourceforge.net/current/STAFPython.htm" target="_top">Python User's
227Guide for STAF V3</a></li><li><a href="http://staf.sourceforge.net/current/STAFTcl.htm" target="_top">Tcl User's
228Guide for STAF V3</a></li><li><a href="http://staf.sourceforge.net/current/stafdg.html" target="_top">STAF V3 Developer's
229Guide</a></li><li><a href="http://staf.sourceforge.net/current/stafsdg.html" target="_top">STAF V3 Service
230Developer's Guide</a></li><li><a href="http://staf.sourceforge.net/current/stafmigrate.html" target="_top">STAF V3 Migration
231Guide</a></li><li><a href="http://staf.sourceforge.net/current/staxgs.pdf" target="_top">Getting Started with STAX V3</a></li><li><a href="http://staf.sourceforge.net/current/staxug.pdf" target="_top">STAX Service User's Guide
232</a></li></ul></div><p>
233</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e181"></a><a name="d0e182"></a><b>1.6.</b></td><td align="left" valign="top"><p>How do I get on/off STAF mailing lists?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
234Go to the <a href="http://sourceforge.net/p/staf/mailman/" target="_top">STAF
235Mailing Lists</a> web page and click on Subscribe or Unsubscribe for the
236STAF mailing list that you want to be added to or removed from.
237</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e192"></a><a name="d0e193"></a><b>1.7.</b></td><td align="left" valign="top"><p>How do I get help?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
238You can submit questions using the
239<a href="http://lists.sourceforge.net/lists/listinfo/staf-users" target="_top">STAF Mailing Lists
240</a> and the <a href="http://sourceforge.net/p/staf/discussion/" target="_top">STAF
241Discussion Forums</a> on SourceForge.
242</p><p>
243If you are an IBMer, you may use the following IBM Forum to submit questions
244for STAF, STAX, and its services:
245</p><p>
246</p><div class="itemizedlist"><ul type="disc"><li><a href="http://ibmforums.ibm.com/forums/forum.jspa?forumID=2484" target="_top">Automation Infrastructure and Solutions (AIS) Forum</a></li></ul></div><p>
247</p><p>
248You can also get help about a STAF service's request syntax by using the
249following command:
250</p><p>
251<span><b class="command">STAF local <i class="replaceable"><tt>service</tt></i> HELP</b></span>
252</p><p>This will return the available options for the &lt;service&gt;</p><p>
253</p><p>
254You can find out more information about STAF error codes by using the
255following command:
256</p><p>
257<span><b class="command">STAF local HELP ERROR 7</b></span>
258</p><p>This will return detailed information about error code 7.</p><p>
259</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e235"></a><a name="d0e236"></a><b>1.8.</b></td><td align="left" valign="top"><p>How do I request a feature for STAF?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
260To request a feature (or browse a list of requested features), click
261<a href="http://sourceforge.net/p/staf/feature-requests/" target="_top">
262here</a>.
263</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e246"></a><a name="d0e247"></a><b>1.9.</b></td><td align="left" valign="top"><p>Why isn't STAF written in Java?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
264</p><div class="orderedlist"><ol type="1"><li><p>
265<span class="emphasis"><em>
266STAF is designed to put as few dependencies on the underlying system as
267possible.
268</em></span>
269To that end we designed STAF to consume as little memory,
270disk, and CPU as possible.  Some of these items (particularly disk
271space) aren't nearly as important as they were several years ago.
272However, almost every new group that picks up STAF asks this very same
273question, "How much &lt;room&gt; does STAF require?".  Along these same
274lines, we didn't want to require any additional software on the system
275in order to run STAF.  Writing STAF in Java would obviously require
276a JVM.  Of the three resources previously listed, this has the largest
277impact on memory, and then CPU.  Again, this isn't as large an issue
278as it once was, as many/most systems today have a JVM.  Nevertheless,
279we have many groups who are reluctant to put a JVM on their system, particularly
280those doing base OS testing (like the AIX and Linux Technology Center)
281teams, and they definitely don't like being dependent on a JVM.  For
282example, we have a group using STAF on Linux/PPC-64.  This platform
283still doesn't have a stable JVM.  And, the Linux JVMs, in general,
284have struggled for stability of the years (particularly on SMP systems).
285For what it's worth, we've had people tell us that STAF should have been
286built using MQ Series, or Java, or Perl, or &lt;insert favorite technology&gt;.
287Obviously, we can't appease all these groups, as they are mutually exclusive
288requests.  In the end, STAF only depends on a base operating system,
289and a working compiler (for use in porting it).
290</p><p>
291The following items all deal with the inability to write a 100% pure-Java
292implementation.  If you can't go 100% (or darn close to it), a lot
293of Java's appeal dies away.
294</p></li><li><p>
295<span class="emphasis"><em>
296STAF is designed to be extensible from a variety of languages.
297</em></span>
298In order to invoke these other languages, you need the ability to call
299native code.  Obviously, from Java, this puts you into JNI land and
300out of 100% pure-Java land.  At the moment, STAF supports service
301written in C/C++, Java, and Rexx.  Perl support is being actively
302developed in Hursley.  Other languages are feasible, given a way to
303communicate with the language from C/C++.  For example, we have prototyped
304Tcl and Python service support, but have not done full-blown implementations
305due to lack of user demand, although both languages are picking up steam
306(from their user communities).  For what its worth, C/C++ and Java
307are the most common implementation languages for STAF services.  Rexx
308was important early in STAF's life, but has effectively died off (from
309a service point of view), although there are a few groups that still use
310it do to Rexx having a long heritage (and deep roots) at IBM.
311</p></li><li><p>
312<span class="emphasis"><em>Performance.</em></span>
313Several of STAF's services (due to their nature)
314require as much performance as they can squeeze out (Log and Monitor are
315the primary examples here).  This, effectively, means writing them
316in C/C++.  In addition, the (local) IPC performance is important
317for the performance of STAF.  To get the best performance here, you
318need to use native IPC communications instead of IP Sockets (when talking
319locally).  Some operating systems (notably AIX, at least when we tested on the
3204.3 release a couple of years ago), have horrible performance for local
321IP Sockets when compared with their native IPC mechanisms (e.g., Unix sockets,
322named/anonymous pipes, shared memory).  Again, from a Java perspective,
323these things put you in JNI land.  And, then, of course, there
324is your basic run-of-the-mill performance problems with Java.  The
325JIT helps, but rarely comes anywhere near natively compiled code.
326</p></li><li><p>
327<span class="emphasis"><em>Access to base OS features.</em></span>  The most important example
328here is starting processes (e.g., STAF's Process service). We allow you
329to specify alternate shells to use when starting processes, to start processes
330under different user IDs, to specify additional environment variables for
331the process, amongst other abilities.  Java makes some of these things
332more difficult to implement (e.g., additional environment variables) and
333some nigh-impossible (e.g. different user IDs) without resorting to native
334code.  And, yes, all these items are used by multiple STAF users/teams.
335Other items in this category are interacting with security systems and
336dealing with additional file system attributes (e.g., permission bits on
337unix systems, attributes on Win32 systems, ACLs on any system), both of
338which are planned for future versions of STAF.
339</p></li></ol></div><p>
340</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e281"></a><a name="d0e282"></a><b>1.10.</b></td><td align="left" valign="top"><p>What is the performance overhead of running STAF?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
341As a general rule, STAF takes up very little system resources.
342A typical STAF installation is about 10-30 MB (depending on whether you
343use the installer with the integrated JVM).  STAF's in-memory size
344(without any additional external services) is about 2.5-5 MB (depending
345on the platform).  On an idle STAF system (i.e., one in which there
346are no requests currently being handled by STAF) STAF consumes 0% CPU on
347a Windows system and a VERY limited amount on unix systems.  On unix,
348we have a thread which wakes up once a second to see if any STAF processes
349have completed.  STAF was designed to consume as little system resources
350as possible, as we know that people want their test systems as close to
351clean-room conditions as possible.
352</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e289"></a><a name="d0e290"></a><b>1.11.</b></td><td align="left" valign="top"><p>How do I interact with STAF?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
353You can interact with STAF from many languages (Java, C, C++, Python,
354Perl, Tcl, Rexx) and from the command line/shell prompt. See the "API Reference"
355and "Commands" sections in the STAF User's Guide for more information.
356</p><p>
357If you need support for another language, open a <a href="http://sourceforge.net/p/staf/feature-requests/" target="_top">
358feature request</a> on the STAF SourceForge web site.
359</p><p>
360If you can't wait, provide support for your favorite language yourself
361since STAF is open sourced.
362</p><p></p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e304"></a><h3 class="title"><a name="d0e304"></a>2. How-to Questions</h3></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>2.1.  <a href="#d0e307">Installation/Configuration</a></dt><dd><dl><dt>2.1.1. <a href="#d0e310">How do I install STAF?</a></dt><dt>2.1.2. <a href="#d0e318">How do I install STAF in silent mode?</a></dt><dt>2.1.3. <a href="#d0e347">How do I configure STAF?</a></dt><dt>2.1.4. <a href="#d0e355">How can I determine which version/architecture of STAF is installed?</a></dt></dl></dd><dt>2.2.  <a href="#d0e410">Starting STAF</a></dt><dd><dl><dt>2.2.1. <a href="#How do I load STAFEnv.sh automatically for each terminal window I open on Unix?">
363How do I load STAFEnv.sh automatically for each terminal window I open on Unix?
364</a></dt></dl></dd><dt>2.3.  <a href="#d0e436">PROCESS Service</a></dt><dd><dl><dt>2.3.1. <a href="#d0e439">How do I redirect output from a process started by STAF?</a></dt><dt>2.3.2. <a href="#d0e451">
365How do I run a complex command that I can type at a shell (command) prompt
366via STAF?
367</a></dt><dt>2.3.3. <a href="#d0e480">
368How do I quote options that contain white space (e.g. pathnames containing spaces, etc.) via STAF?
369</a></dt><dt>2.3.4. <a href="#d0e553">
370How do I use a static handle to have multiple programs access variables and
371log data?
372</a></dt><dt>2.3.5. <a href="#d0e566">
373How do I change the system date/time to a prior date/time via a PROCESS
374START request?
375</a></dt></dl></dd><dt>2.4.  <a href="#d0e608">LOG Service</a></dt><dd><dl><dt>2.4.1. <a href="#d0e611">How do I make each application have its own STAF log file?</a></dt><dt>2.4.2. <a href="#d0e648">
376How do I view a STAF log as it appears to be in some weird format?
377</a></dt></dl></dd><dt>2.5.  <a href="#d0e664">HTTP Service</a></dt><dd><dl><dt>2.5.1. <a href="#d0e667">
378Does the HTTP Service retain session information across multiple requests?
379</a></dt></dl></dd><dt>2.6.  <a href="#d0e675">STAX Service</a></dt><dd><dl><dt>2.6.1. <a href="#d0e678">
380How do I access system date and time in a STAX job?
381</a></dt><dt>2.6.2. <a href="#d0e690">
382How do I search for multiple strings in testcase output files in STAX?
383</a></dt><dt>2.6.3. <a href="#d0e714">
384How do I access STAF system variable values via a STAX job?
385</a></dt><dt>2.6.4. <a href="#d0e738">
386How do I use the &lt;stopusing&gt; element in a STAX job that runs on both
387Windows and Unix?
388</a></dt><dt>2.6.5. <a href="#d0e751">
389Does a STAX process element use the workdir element as the path to the command?
390</a></dt><dt>2.6.6. <a href="#d0e770">
391How do I use STAF and STAX to boot and shutdown VMWare images on my test machines?
392</a></dt><dt>2.6.7. <a href="#d0e782">
393How can I parse an XML file from a STAX job?
394</a></dt></dl></dd><dt>2.7.  <a href="#d0e794">Globalization</a></dt><dd><dl><dt>2.7.1. <a href="#d0e797">
395How do I use STAF/STAX in environments where machines running STAF have
396different locales?
397</a></dt><dt>2.7.2. <a href="#d0e814">
398How do I specify non-ASCII characters in a STAF request or STAX job?
399</a></dt><dt>2.7.3. <a href="#d0e855">
400How do I know what codepage STAF is using on my machine?
401</a></dt></dl></dd></dl></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e307"></a><h4 class="title"><a name="d0e307"></a>2.1. Installation/Configuration</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>2.1.1. <a href="#d0e310">How do I install STAF?</a></dt><dt>2.1.2. <a href="#d0e318">How do I install STAF in silent mode?</a></dt><dt>2.1.3. <a href="#d0e347">How do I configure STAF?</a></dt><dt>2.1.4. <a href="#d0e355">How can I determine which version/architecture of STAF is installed?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e310"></a><a name="d0e311"></a><b>2.1.1.</b></td><td align="left" valign="top"><p>How do I install STAF?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
402STAF provides its own installation program which uses InstallAnywhere
403for supported platforms. On Unix platforms, we also provide
404a shell script-based installation mechanism.  See the STAF Installation
405Guide for detailed instructions on how to install STAF.
406</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e318"></a><a name="d0e319"></a><b>2.1.2.</b></td><td align="left" valign="top"><p>How do I install STAF in silent mode?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
407Here are the commands to install STAF in silent mode (these examples are
408for Win32):
409</p><p>If using the InstallAnywhere executable:</p><p>
410</p><pre class="screen">
411<tt class="prompt">C:\temp&gt;</tt><span><b class="command">STAF330-setup-win32 -i silent -DACCEPT_LICENSE=1</b></span>
412</pre><p>
413</p><p>To override the default location where STAF is installed during a silent
414installation, you can specify the following option:</p><p>
415</p><pre class="screen">
416<tt class="prompt">C:\temp&gt;</tt><span><b class="command">STAF330-setup-win32 -i silent -DACCEPT_LICENSE=1 -DUSER_INSTALL_DIR=C:\tools\staf</b></span>
417</pre><p>
418</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e347"></a><a name="d0e348"></a><b>2.1.3.</b></td><td align="left" valign="top"><p>How do I configure STAF?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
419STAF is configured through a text file called the STAF Configuration
420File. This file may have any name you desire, but the default is STAF.cfg.
421The STAF configuration File is read and processed line by line. The various
422configuration options are described in the Configuration section in the
423STAF User's Guide.
424</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e355"></a><a name="d0e356"></a><b>2.1.4.</b></td><td align="left" valign="top"><p>How can I determine which version/architecture of STAF is installed?</p><p>
425After the STAF install is complete, an install.properties file will be created
426in the root STAF install directory.  The file will contain key/value pairs
427that provide information about the version of STAF that has been installed.
428</p><p>
429The install.properties file will contain the following information:
430</p><div class="itemizedlist"><ul type="disc"><li><span><b class="command">version</b></span> - the version of STAF that has been
431installed
432</li><li><span><b class="command">platform</b></span> - the STAF platform name
433</li><li><span><b class="command">architecture</b></span> - the architecture of the STAF build (32-bit or
43464-bit)
435</li><li><span><b class="command">installer</b></span> - the type of installer (InstallAnywhere, STAFInst)
436</li><li><span><b class="command">file</b></span> - the file used to install STAF
437</li><li><span><b class="command">osname</b></span> - the operating system name for the STAF build
438(equivalent to the "os.name" Java property)
439</li><li><span><b class="command">osversion</b></span> - the operating system version supported by the
440STAF build ("*" indicates the build is supported on any version of the OS; a
441version number followed by a "+" indicates the build supports that version or
442later)
443</li><li><span><b class="command">osarch</b></span> - the operating system architecture supported by
444the STAF build (equivalent to the "os.arch" Java property)
445</li></ul></div><p>
446</p><p>Here is a sample install.properties file from a Windows system
447(using the IA installer):
448</p><pre class="programlisting">
449version=3.3.0
450platform=win32
451architecture=32-bit
452installer=IA
453file=STAF330-setup-win32.exe
454osname=Windows
455osversion=*
456osarch=x86
457</pre><p>Here is a sample install.properties file from a Mac OS X Universal system
458(using the STAFInst installer):
459</p><pre class="programlisting">
460version=3.4.11
461platform=macosx-universal
462architecture=32-bit/64-bit
463installer=STAFInst
464file=STAF3411-macosx-universal.tar
465osname=Mac OS X
466osversion=10.6+
467osarch=universal (i386, x86_64, ppc)
468</pre><p></p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
469
470</p><p></p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e410"></a><h4 class="title"><a name="d0e410"></a>2.2. Starting STAF</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>2.2.1. <a href="#How do I load STAFEnv.sh automatically for each terminal window I open on Unix?">
471How do I load STAFEnv.sh automatically for each terminal window I open on Unix?
472</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="How do I load STAFEnv.sh automatically for each terminal window I open on Unix?"></a><a name="d0e414"></a><b>2.2.1.</b></td><td align="left" valign="top"><p>
473How do I load STAFEnv.sh automatically for each terminal window I open on Unix?
474</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><div class="procedure"><p>Note: Be aware of all the leading dots ('.') and dot spaces (". ") in the following steps.
475They are crucial and are functionally distinct.</p><ol type="1"><li><p>Edit your .profile.  If a file called /.profile  (in linux it's /root/.profile) does not exist, just create it.
476</p><pre class="programlisting">
477prompt&gt; vi /.profile
478</pre><p>
479Add the following line to your .profile:
480</p><pre class="programlisting">
481 . /usr/local/staf/STAFEnv.sh
482</pre><p>
483and save the file.
484</p></li><li><p>Run your .profile:
485</p><pre class="programlisting">
486prompt&gt; .  /.profile
487</pre><p>
488Now when you create a terminal or log in, the STAFEnv variables will be loaded.
489</p></li></ol></div></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e436"></a><h4 class="title"><a name="d0e436"></a>2.3. PROCESS Service</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>2.3.1. <a href="#d0e439">How do I redirect output from a process started by STAF?</a></dt><dt>2.3.2. <a href="#d0e451">
490How do I run a complex command that I can type at a shell (command) prompt
491via STAF?
492</a></dt><dt>2.3.3. <a href="#d0e480">
493How do I quote options that contain white space (e.g. pathnames containing spaces, etc.) via STAF?
494</a></dt><dt>2.3.4. <a href="#d0e553">
495How do I use a static handle to have multiple programs access variables and
496log data?
497</a></dt><dt>2.3.5. <a href="#d0e566">
498How do I change the system date/time to a prior date/time via a PROCESS
499START request?
500</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e439"></a><a name="d0e440"></a><b>2.3.1.</b></td><td align="left" valign="top"><p>How do I redirect output from a process started by STAF?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
501You can't use the command line redirection symbols, such as '&gt;', with
502STAF. They won't work. However, STAF's PROCESS service provides several
503redirection options, namely STDIN, STDOUT, STDOUTAPPEND, STDERR, and
504STDERRAPPEND, depending on what (and how) you want to redirect.
505</p><p>
506For example, to start shell script tc3.sh and redirect its standard
507output to /tmp/tc3.out:
508</p><span><b class="command">STAF local PROCESS START COMMAND tc3.sh STDOUT /tmp/tc3.out</b></span><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e451"></a><a name="d0e452"></a><b>2.3.2.</b></td><td align="left" valign="top"><p>
509How do I run a complex command that I can type at a shell (command) prompt
510via STAF?
511</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
512The PROCESS service has a SHELL parameter which specifies that COMMAND
513should be executed as though you were at a shell prompt. This allows complex
514commands involving pipelines to be readily executed. Note, if COMMAND and
515PARMS are both specified they will be concatenated with a space between
516them, and the resulting string is what will be executed.
517</p><table class="simplelist" border="0" summary="Simple list"><tr><td>
518<p>Unix Command Line Example:</p>
519<span><b class="command">
520STAF local PROCESS START SHELL COMMAND "ps | grep test | wc &gt;testcount.txt"
521</b></span>
522</td></tr></table><p> </p><table class="simplelist" border="0" summary="Simple list"><tr><td>
523<p>Windows Command Line Example:</p>
524<span><b class="command">
525STAF local PROCESS START SHELL COMMAND "dir *.*"
526</b></span>
527</td></tr></table><p> </p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e480"></a><a name="d0e481"></a><b>2.3.3.</b></td><td align="left" valign="top"><p>
528How do I quote options that contain white space (e.g. pathnames containing spaces, etc.) via STAF?
529</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
530</p><p>
531You must specify quotes around pathnames that contain white space and you need to
532specify double quotes around the entire option value.  To have double quotes contained
533within double quotes, you need to escape them with a backslash, e.g. \".
534Here are some examples of how to quote options that contain white space in PROCESS START requests:
535</p><div class="orderedlist"><ol type="1"><li><p>
536Say you wanted to run the following command using a STAF PROCESS START request
537via a Windows command prompt:
538</p><span><b class="command">
539copy "C:\Program Files\file1.txt" "C:\Program Files\file2.txt"
540</b></span><p>
541Using the STAF PROCESS START request, you must specify quotes around the filenames and you
542need to specify double quotes around the entire COMMAND option value.  To have double quotes contained
543within double quotes, you need to escape them with a backslash (e.g. \").  And, you'll want to use the SHELL option.
544So, for example:
545</p><pre class="programlisting">
546C:\&gt;STAF local PROCESS START SHELL COMMAND "copy \"C:\Program Files\file1.txt\" \"C:\Program Files\file2.txt\"" WAIT RETURNSTDOUT STDERRTOSTDOUT
547Response
548--------
549{
550  Return Code: 0
551  Key        : &lt;None&gt;
552  Files      : [
553    {
554      Return Code: 0
555      Data       :         1 file(s) copied.
556
557    }
558  ]
559}
560</pre><p>
561Note that when executing a STAF command from a program (e.g. from a Java program), you can use the
562STAFUtil.wrapData() function provided to wrap option value.  See the STAF Java User's Guide for more
563information if your submitting STAF commands via a Java program instead of from the command line.
564</p><p>
565Note that instead of copying a file this way, you should use the STAF FS (File System) service instead
566(which works on all operating systems and allows you to copy files to other machines, not just to the
567same machine, if desired).  For example:
568</p><pre class="programlisting">
569C:\&gt;STAF local FS COPY FILE "C:\Program Files\file1.txt" TOFILE "C:\Program Files\file2.txt"
570Response
571--------
572
573</pre><p>
574See the STAF User's Guide for more information on the FS service and the COPY FILE and
575COPY DIRECTORY requests.
576</p></li><li><p>
577Say you wanted to run the following command using a STAF PROCESS START request
578via a Windows command prompt:
579</p><span><b class="command">
580dir "C:\Program Files"
581</b></span><p>
582To run this command using a STAF PROCESS START request via a Windows command prompt:
583</p><pre class="programlisting">
584C:\&gt;STAF local PROCESS START SHELL COMMAND "dir \"C:\Program Files\"" WAIT RETURNSTDOUT STDERRTOSTDOUT
585Response
586--------
587{
588  Return Code: 0
589  Key        : &lt;None&gt;
590  Files      : [
591    {
592      Return Code: 0
593      Data       :  Volume in drive C has no label.
594 Volume Serial Number is B0B7-F95A
595
596 Directory of C:\Program Files
597
59802/17/2003  09:52a      &lt;DIR&gt;          .
59902/17/2003  09:52a      &lt;DIR&gt;          ..
60002/17/2003  09:52a      &lt;DIR&gt;          Common Files
60102/17/2003  09:58a      &lt;DIR&gt;          Windows NT
602...
603               1 File(s)        185,037 bytes
604              51 Dir(s)  25,483,706,368 bytes free
605
606    }
607  ]
608}
609</pre><p>
610However, it makes more sense to use the STAF FS service's LIST DIRECTORY request.
611For example:
612</p><pre class="programlisting">
613C:\&gt;STAF local FS LIST DIRECTORY "C:\Program Files"
614Response
615--------
616Common Files
617Windows NT
618...
619</pre>
620or
621<pre class="programlisting">
622C:\&gt;STAF local FS LIST DIRECTORY "C:\Program Files" LONG
623Response
624--------
625Type Size  Modified Date-Time Name
626---- ----- ------------------ --------------------------------------
627D    0     20030217-09:52:38  Common Files
628D    0     20030217-09:58:02  Windows NT
629...
630</pre><p>
631See the STAF User's Guide for more information on the FS service and the LIST DIRECTORY
632request and all of it's options.
633</p></li><li><p>
634Say you wanted to run the following command:
635</p><span><b class="command">
636more "C:\Program Files\file1.txt"
637</b></span><p>
638Using the STAF PROCESS START command to run this command, you must use the SAMECONSOLE
639option if you don't redirect all 3 streams (STDID, STDOUT, STDERR) if the command you're running
640accesses STDIN.  There's a note about this in the STAF User's Guide in the section about the
641PROCESS START command.
642</p><pre class="programlisting">
643C:\&gt;STAF local PROCESS START SHELL COMMAND "more \"C:\Program Files\file1.txt\"" WAIT RETURNSTDOUT STDERRTOSTDOUT SAMECONSOLE
644Response
645--------
646{
647  Return Code: 0
648  Key        : &lt;None&gt;
649  Files      : [
650    {
651      Return Code: 0
652      Data       : This is line 1.
653This is line 2.
654
655    }
656  ]
657}
658</pre><p>
659Also, note that if you have a lot of data in the file, using the command "more" specifies
660to prompt you whether you want to display more data.  So, you would have to provide
661a STDIN file using the STDIN option containing the appropriate responses.
662In an automated environment, it doesn't make much sense  to use
663the Windows more command.  Instead, you should use the STAF FS GET FILE command
664to get the contents of a text file.  For example:
665</p><pre class="programlisting">
666C:\&gt;STAF local FS GET FILE "C:\Program Files\file1.txt"
667Response
668--------
669This is line 1.
670This is line 2.
671</pre></li><li><p>
672Say you wanted to run the following command:
673</p><span><b class="command">
674echo this is the string to be parsed &gt; "C:\Program Files\echofile.txt"
675</b></span><p>
676To run it via a PROCESS START command:
677</p><pre class="programlisting">
678C:\&gt;STAF local PROCESS START SHELL COMMAND "echo this is the string to be parsed &gt; \"C:\Program Filesr\echofile.txt\"" WAIT RETURNSTDOUT STDERRTOSTDOUT
679Response
680--------
681{
682  Return Code: 0
683  Key        : &lt;None&gt;
684  Files      : [
685    {
686      Return Code: 0
687      Data       :
688    }
689  ]
690}
691</pre><p>
692However, instead of using &gt; in the command, you should use the STDOUT option instead.
693</p><pre class="programlisting">
694C:\&gt;STAF local PROCESS START SHELL COMMAND "echo this is the string to be parsed" STDOUT "C:\Program Files\echofile.txt" WAIT RETURNSTDOUT STDERRTOSTDOUT
695Response
696--------
697{
698  Return Code: 0
699  Key        : &lt;None&gt;
700  Files      : [
701    {
702      Return Code: 0
703      Data       : this is the string to be parsed
704
705    }
706  ]
707}
708</pre></li></ol></div><p> </p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e553"></a><a name="d0e554"></a><b>2.3.4.</b></td><td align="left" valign="top"><p>
709How do I use a static handle to have multiple programs access variables and
710log data?
711</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
712If you have a program (PROG-A) that creates a static handle, and you
713want to start another program (PROG-B) using the STAF start command,
714such that PROG-B can create variables and a log using that same handle.
715The problem is that each program has to know the number of the static handle
716in order to use it.  You can do this via an environment variable.
717So, from PROG-A, you could do something like:
718</p><pre class="programlisting">
719request = 'start command cmd.exe parms "/c PROG-B" env STAFHANDLE='staticHandle
720call STAFSubmit 'local', 'process', request
721</pre><p>
722</p><p>
723Then, PROG-B can pull the static handle from the environment variable.
724</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e566"></a><a name="d0e567"></a><b>2.3.5.</b></td><td align="left" valign="top"><p>
725How do I change the system date/time to a prior date/time via a PROCESS
726START request?
727</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
728If you change the system date/time on a machine to a prior date/time via a
729STAF PROCESS START request (with the WAIT option), you may encounter a problem
730where the PROCESS START request hangs.
731</p><p>This is a timing issue where the STAF
732thread which periodically checks for processes that have completed is
733waiting for an incorrect amount of time to wake up and check for the
734processes.  When the date is set to an earlier date/time (while this thread
735is already waiting), the call to pthread_cond_timedwait (which should only
736be waiting for a second) is now waiting for the "earlier" time which causes
737it to hang.  If you set the date to a later date/time, the
738pthread_cond_timedwait will return immediately.
739</p><p>
740This problem was fixed in STAF V3.4.21 for Unix operating systems that support
741monotonic clocks.  Upgrade to STAF V3.4.21 or later if you are encountering
742ths problem.  Note that HP-UX, Mac OS X, and z/OS do not support monotonic
743clocks.
744</p><p>
745Another workaround is to run the PROCESS START request asynchronously (i.e. omit
746the WAIT option).  Then, after starting the process asynchronously, delay for a
747certain number of seconds (to allow the  system date to be updated), then
748run a synchronous PROCESS START request where the command is "date" (to
749verify that it has been correctly updated), and then continue on with your
750tests.
751</p><p>
752Here is a command line example (from a RHEL6 system) of how you can
753validate the process to change the date to a prior time has worked.
754</p><p>
755First check the current date:
756</p><pre class="programlisting">
757# STAF local PROCESS START SHELL COMMAND "date" RETURNSTDOUT STDERRTOSTDOUT WAIT
758Response
759--------
760{
761  Return Code: 0
762  Key        : &lt;None&gt;
763  Files      : [
764    {
765      Return Code: 0
766      Data       : Wed Oct  6 09:10:20 CDT 2010
767
768    }
769  ]
770}
771</pre><p>
772Next, run the PROCESS to change the date to an earlier time, and specify
773the STDOUT &lt;file&gt; and STDERRTOSTDOUT options., but not the WAIT option:
774</p><pre class="programlisting">
775# STAF local PROCESS START SHELL COMMAND "date +%T -s 09:00:01" STDOUT {STAF/DataDir}/tmp/date-output.txt STDERRTOSTDOUT
776Response
777--------
77834
779</pre><p>
780Note that the response, 34, is the handle number for this process, which
781we will use later to check the RC of the process.
782</p><p>
783Next, check the current date again and you see the time was updated:
784</p><pre class="programlisting">
785# STAF local PROCESS START SHELL COMMAND "date" RETURNSTDOUT STDERRTOSTDOUT WAIT
786Response
787--------
788{
789  Return Code: 0
790  Key        : &lt;None&gt;
791  Files      : [
792    {
793      Return Code: 0
794      Data       : Wed Oct  6 09:00:04 CDT 2010
795
796    }
797  ]
798}
799</pre><p>
800Note that the process which updated the system date is still not complete
801(even though the actual "date" process has finished).  Running the above
802command will cause the thread waiting for process completions to finish to
803wake up (it wakes up at the timeout, or whenever a new process starts).
804</p><p>
805So now we can query the PROCESS handle:
806</p><pre class="programlisting">
807# STAF local PROCESS QUERY HANDLE 34
808Response
809--------
810Handle         : 34
811Handle Name    : &lt;None&gt;
812Title          : &lt;None&gt;
813Workload       : &lt;None&gt;
814Shell          : &lt;Default Shell&gt;
815Command        : date +%T -s 09:00:01
816Parms          : &lt;None&gt;
817Workdir        : &lt;None&gt;
818Focus          : Background
819User Name      : &lt;None&gt;
820Key            : &lt;None&gt;
821PID            : 7690
822Start Mode     : Async
823Start Date-Time: 20101006-09:13:44
824End Date-Time  : 20101006-09:00:04
825Return Code    : 0
826</pre><p>
827So we see the process completed with a return code 0.
828</p><p>
829And we can get the content of the standard output/error file:
830</p><pre class="programlisting">
831# STAF local FS GET FILE {STAF/DataDir}/tmp/date-output.txt
832Response
833--------
83409:00:01
835</pre><p></p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e608"></a><h4 class="title"><a name="d0e608"></a>2.4. LOG Service</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>2.4.1. <a href="#d0e611">How do I make each application have its own STAF log file?</a></dt><dt>2.4.2. <a href="#d0e648">
836How do I view a STAF log as it appears to be in some weird format?
837</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e611"></a><a name="d0e612"></a><b>2.4.1.</b></td><td align="left" valign="top"><p>How do I make each application have its own STAF log file?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
838Use HANDLE logs instead of GLOBAL logs. With HANDLE logs each application
839will get a physically separate log file. HANDLE logs keep separate logs
840for each process even if the processes are using the same log names. The
841downside to HANDLE logs is you need to remember the handles you were using,
842so that you can query them. For example if you log data to a handle log,
843like so:
844</p><pre class="screen">
845<span><b class="command">STAF local log LOG HANDLE LOGNAME testit LEVEL info MESSAGE hello</b></span>
846</pre><p>
847then you can query it like so:
848</p><pre class="screen">
849<span><b class="command">STAF local log QUERY MACHINE <i class="replaceable"><tt>m1</tt></i> HANDLE <i class="replaceable"><tt>h1</tt></i> LOGNAME testit</b></span>
850</pre><p>
851</p><p>
852In this request you need to know <i class="replaceable"><tt>m1</tt></i> (which
853should be your machines name) and <i class="replaceable"><tt>h1</tt></i> which you
854won't know until your program is executed.
855</p><p>
856</p><p>
857To facilitate HANDLE based logs, it is probably a good idea for programs
858using them to write their name and handle to a GLOBAL log so that you can
859determine which HANDLE logs you need to query.
860</p><p>
861</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e648"></a><a name="d0e649"></a><b>2.4.2.</b></td><td align="left" valign="top"><p>
862How do I view a STAF log as it appears to be in some weird format?
863</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
864This is the expected format for STAF logs (they are binary files, not
865text files).  As a general rule you should use the LOG service itself
866to look at the logs.  For example:
867</p><pre class="screen">
868<span><b class="command">STAF local log query global logname stresstst</b></span>
869</pre><p>
870</p><p>
871You can redirect that to another file, which will be in text format,
872if you want. You can also use the FmtLog utility (shipped with STAF)
873which will read a log file and format and write the data to an output file
874in a readable format.
875</p><p></p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e664"></a><h4 class="title"><a name="d0e664"></a>2.5. HTTP Service</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>2.5.1. <a href="#d0e667">
876Does the HTTP Service retain session information across multiple requests?
877</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e667"></a><a name="d0e668"></a><b>2.5.1.</b></td><td align="left" valign="top"><p>
878Does the HTTP Service retain session information across multiple requests?
879</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
880Yes.  Version 2.0 (and later) of the HTTP service provides the ability to group
881requests to the HTTP service together in a session. Performing requests in a session
882provides the ability simulate a browsing experience. Since a session provides memory
883about the last request it is possible to manipulate cookies, login into secure web
884sites, and interact with form and link html elements that are returned from requests.
885</p><p></p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e675"></a><h4 class="title"><a name="d0e675"></a>2.6. STAX Service</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>2.6.1. <a href="#d0e678">
886How do I access system date and time in a STAX job?
887</a></dt><dt>2.6.2. <a href="#d0e690">
888How do I search for multiple strings in testcase output files in STAX?
889</a></dt><dt>2.6.3. <a href="#d0e714">
890How do I access STAF system variable values via a STAX job?
891</a></dt><dt>2.6.4. <a href="#d0e738">
892How do I use the &lt;stopusing&gt; element in a STAX job that runs on both
893Windows and Unix?
894</a></dt><dt>2.6.5. <a href="#d0e751">
895Does a STAX process element use the workdir element as the path to the command?
896</a></dt><dt>2.6.6. <a href="#d0e770">
897How do I use STAF and STAX to boot and shutdown VMWare images on my test machines?
898</a></dt><dt>2.6.7. <a href="#d0e782">
899How can I parse an XML file from a STAX job?
900</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e678"></a><a name="d0e679"></a><b>2.6.1.</b></td><td align="left" valign="top"><p>
901How do I access system date and time in a STAX job?
902</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
903You can either use the python libraries or the java libraries.
904Here is a STAX job which shows both approaches:
905</p><div class="example"><a name="d0e685"></a><p class="title"><b>Example&nbsp;1.&nbsp;
906Accessing system date and time via Python libraries and Java libraries
907</b></p><pre class="programlisting">
908&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
909&lt;!DOCTYPE stax SYSTEM "stax.dtd"&gt;
910
911&lt;stax&gt;
912
913  &lt;defaultcall function="test"/&gt;
914
915  &lt;function name="test"&gt;
916    &lt;sequence&gt;
917
918      &lt;!-- get the python date --&gt;
919      &lt;script&gt;
920        from time import localtime, strftime
921        currenttime = strftime("%a, %d %b %Y %H:%M:%S", localtime())
922      &lt;/script&gt;
923
924      &lt;message&gt;'Python time: %s' % currenttime&lt;/message&gt;
925
926      &lt;!-- get the java date --&gt;
927      &lt;script&gt;
928        from java.util import Calendar, Date
929        from java.text import SimpleDateFormat
930        formatter = SimpleDateFormat("yyyy.MM.dd G 'at' hh:mm:ss a zzz")
931        currentTimestamp = Date()
932        dateString = formatter.format(currentTimestamp)
933      &lt;/script&gt;
934
935      &lt;message&gt;'Java time: %s' % dateString&amp;lt&lt;/message&gt;
936
937    &lt;/sequence&gt;
938  &lt;/function&gt;
939
940&lt;/stax&gt;
941</pre></div></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e690"></a><a name="d0e691"></a><b>2.6.2.</b></td><td align="left" valign="top"><p>
942How do I search for multiple strings in testcase output files in STAX?
943</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
944You can use the Python re library to search for multiple strings in
945testcase output files.  For example, if you have a testcase output
946file c:/temp/test.txt:
947</p><div class="example"><a name="d0e697"></a><p class="title"><b>Example&nbsp;2.&nbsp;Contents of testcase output file c:/temp/test.txt</b></p><pre class="programlisting">
948********************************* Top of Data **********************************
949---------+---------+---------+---------+---------+---------+---------+---------+
950   SET CURRENT SQLID='DBTIFAHC';
951---------+---------+---------+---------+---------+---------+---------+---------+
952DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0
953---------+---------+---------+---------+---------+---------+---------+---------+
954   SELECT * FROM SPA_FI_REGISTRY;
955---------+---------+---------+---------+---------+---------+---------+---------+
956FI_ID     AVLBLTY_STATUS  UPDATE_USER_ID
957UPDATE_TMSTP
958---------+---------+---------+---------+---------+---------+---------+---------+
959IBANKA    S
960STCCICS         2003-07-11-08.38.37.638163
961DSNE610I NUMBER OF ROWS DISPLAYED IS 1
962DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100
963---------+---------+---------+---------+---------+---------+---------+---------+
964-- INSERT INTO IFS_SESSN_ACTIVE
965--   (USR_ID, FI_ID,SERV_ID,SESSN_NBR,IP_ADDR,SESSN_STRT_TMSTP,
966--    SESSN_END_TMSTP,SESSN_ST_CODE, SESSN_MQ_QUALIFIER,CHK_DUPL_TXN,
967--    SERV_INST_NBR)
968  F1=Help    F2=Split   F3=Exit    F5=Rfind   F7=Up      F8=Down    F9=Swap
969 F10=Left   F11=Right  F12=Cancel
970                            SPUFI                              SSID: DB71
971 ===&gt;
972
973 Enter the input data set name:        (Can be sequential or partitioned)
974  1  DATA SET NAME ... ===&gt; 'MONICA1.IFSSCCAH.SPUFI.CNTL(SELECT)'
975  2  VOLUME SERIAL ... ===&gt;            (Enter if not cataloged)
976  3  DATA SET PASSWORD ===&gt;            (Enter if password protected)
977                    * DSNE361I SPUFI PROCESSING COMPLETE *
978
979</pre></div><p>
980Here's a sample STAX job that searches for 3 sets of strings in the
981test.txt file.
982</p><p>
983Notice that when you specify the string text, you need to escape, with
984a backslash, any non-alphanumeric characters (such as spaces, dots, comma,
985equals, greater/less than, parenthesis...).  You can find a Howto
986on Regular Expressions at <a href="http://www.amk.ca/python/howto/regex/" target="_top">
987http://www.amk.ca/python/howto/regex/</a>.
988</p><div class="example"><a name="d0e709"></a><p class="title"><b>Example&nbsp;3.&nbsp;
989Using Python re (regular expression) module to do string matches
990</b></p><pre class="programlisting">
991&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
992&lt;!DOCTYPE stax SYSTEM "stax.dtd"&gt;
993
994&lt;stax&gt;
995
996  &lt;defaultcall function="test"/&gt;
997
998  &lt;function name="test"&gt;
999    &lt;sequence&gt;
1000
1001      &lt;stafcmd&gt;
1002        &lt;location&gt;'local'&lt;/location&gt;
1003        &lt;service&gt;'fs'&lt;/service&gt;
1004        &lt;request&gt;'get file c:/temp/test.txt'&lt;/request&gt;
1005      &lt;/stafcmd&gt;
1006
1007      &lt;script&gt;
1008        import re
1009        result = STAFResult
1010
1011        searchre = r"""(?mx)
1012                       ^.*
1013                       ^.*?IBANKA.*?
1014                       ^.*
1015                       ^.*?1\ \ DATA\ SET\ NAME\ \.\.\.\ \=\=\=\&gt;\ \'MONICA1\.IFSSCCAH\.SPUFI\.CNTL\(SELECT\)\'.*?
1016                       ^.*
1017                       ^.*?DSNE361I\ SPUFI\ PROCESSING\ COMPLETE.*?
1018                       ^.*"""
1019      &lt;/script&gt;
1020
1021      &lt;if expr='re.match(searchre, result) != None'&gt;
1022        &lt;message&gt;'Pass'&lt;/message&gt;
1023        &lt;else&gt;
1024          &lt;message&gt;'Fail'&lt;/message&gt;
1025        &lt;/else&gt;
1026      &lt;/if&gt;
1027
1028    &lt;/sequence&gt;
1029  &lt;/function&gt;
1030
1031&lt;/stax&gt;
1032</pre></div></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e714"></a><a name="d0e715"></a><b>2.6.3.</b></td><td align="left" valign="top"><p>
1033How do I access STAF system variable values via a STAX job?
1034</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1035The STAF variables have to be resolved using
1036either the VAR service through a &lt;stafcmd&gt; or using the
1037STAXUtilImportSTAFVars function from the STAXUtil.xml file (provided
1038with the STAX download in the library subdirectory of the STAX installroot).
1039</p><div class="example"><a name="d0e721"></a><p class="title"><b>Example&nbsp;4.&nbsp;Using &lt;stafcmd&gt; to call the var service</b></p><pre class="programlisting">
1040  &lt;stafcmd&gt;
1041    &lt;location&gt;'local'&lt;/location&gt;
1042    &lt;service&gt;'var'&lt;/service&gt;
1043    &lt;request&gt;'resolve string {STAF/Config/STAFRoot}'&lt;/request&gt;
1044  &lt;/stafcmd&gt;
1045  &lt;script&gt;stafRoot=STAFResult&lt;/script&gt;
1046</pre></div><div class="example"><a name="d0e726"></a><p class="title"><b>Example&nbsp;5.&nbsp;Using the STAXUtilImportSTAFVars function</b></p><pre class="programlisting">
1047  &lt;call function="'STAXUtilImportSTAFVars'"&gt;
1048    [
1049      {'STAF/Env/STAFDir': 'mySTAFDir', 'STAF/Version': 'mySTAFVersion'},
1050      'machA'
1051    ]
1052  &lt;/call&gt;
1053</pre></div><p>and the resulting STAX variables could be:</p><pre class="screen">
1054  mySTAFDir = 'C:\STAF'
1055  mySTAFVersion = '3.2.0'
1056</pre><p>See STAXUtil.html for full details.</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e738"></a><a name="d0e739"></a><b>2.6.4.</b></td><td align="left" valign="top"><p>
1057How do I use the &lt;stopusing&gt; element in a STAX job that runs on both
1058Windows and Unix?
1059</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1060You can first determine whether the machine is Windows or
1061non-Windows, set a variable to the STOPUSING option that you want to use
1062on that operating system, and then use that variable in the &lt;stopusing&gt;
1063element. Here is a sample STAX job:
1064</p><div class="example"><a name="d0e745"></a><p class="title"><b>Example&nbsp;6.&nbsp;Setting the &lt;stopusing&gt; value based on the operating system</b></p><pre class="programlisting">
1065&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
1066&lt;!DOCTYPE stax SYSTEM "stax.dtd"&gt;
1067
1068&lt;stax&gt;
1069
1070  &lt;defaultcall function="test"/&gt;
1071
1072  &lt;function name="test"&gt;
1073    &lt;sequence&gt;
1074
1075      &lt;stafcmd&gt;
1076        &lt;location&gt;'local'&lt;/location&gt;
1077        &lt;service&gt;'var'&lt;/service&gt;
1078        &lt;request&gt;'resolve string {STAF/Config/OS/Name}'&lt;/request&gt;
1079      &lt;/stafcmd&gt;
1080
1081      &lt;script&gt;
1082        import re
1083        osname = STAFResult
1084      &lt;/script&gt;
1085
1086      &lt;if expr='re.search("^win", osname.lower()) != None'&gt;
1087        &lt;script&gt;stopusing = 'WM_CLOSE'&lt;/script&gt;
1088        &lt;else&gt;
1089          &lt;script&gt;stopusing = 'SIGKILLALL'&lt;/script&gt;
1090        &lt;/else&gt;
1091      &lt;/if&gt;
1092
1093      &lt;process&gt;
1094        &lt;location&gt;'local'&lt;/location&gt;
1095        &lt;command&gt;'java'&lt;/command&gt;
1096        &lt;stopusing&gt;stopusing&lt;/stopusing&gt;
1097      &lt;/process&gt;
1098
1099    &lt;/sequence&gt;
1100  &lt;/function&gt;
1101
1102&lt;/stax&gt;
1103</pre></div><p>
1104</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e751"></a><a name="d0e752"></a><b>2.6.5.</b></td><td align="left" valign="top"><p>
1105Does a STAX process element use the workdir element as the path to the command?
1106</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1107No.  The STAF User's Guide, section 8.10.2 (PROCESS START) says:
1108</p><p>
1109COMMAND specifies the actual command that you want to
1110start. If the path to the command is not specified, the
1111system PATH will be searched for the command.
1112</p><p>
1113So, if the path to the command is not specified in the
1114&lt;command&gt; element, the system PATH is searched.  Just specifying
1115the &lt;workdir&gt; will not make it use the workdir as the path and
1116you'll get RC 10 (Base operating system error) because it couldn't
1117find the command executable.
1118</p><p>
1119The following &lt;process&gt; element specifies the path (assigned to variable
1120testdir) to the test1.exe executable since it's not in the system PATH:
1121</p><div class="example"><a name="d0e764"></a><p class="title"><b>Example&nbsp;7.&nbsp;Specifying the path to the executable in the &lt;command&gt;</b></p><pre class="programlisting">
1122  &lt;script&gt;
1123    clientname = 'machineA.austin.ibm.com'
1124    testdir = 'C:/test'
1125  &lt;/script&gt;
1126
1127  &lt;process&gt;
1128    &lt;location&gt;clientname&lt;/location&gt;
1129    &lt;command&gt;'%s/test1.exe' % (testdir)&lt;/command&gt;
1130    &lt;workdir&gt;testdir&lt;/workdir&gt;
1131  &lt;/process&gt;
1132</pre></div><p>
1133</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e770"></a><a name="d0e771"></a><b>2.6.6.</b></td><td align="left" valign="top"><p>
1134How do I use STAF and STAX to boot and shutdown VMWare images on my test machines?
1135</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1136You can use STAF/STAX to boot VMWare images and then execute tests
1137on the VMWare images.  Below is a example that demonstrates how to
1138do this.  The "startvmware" function boots a VMWare image.  Note
1139that it's &lt;function-prolog&gt; has important information on how to configure
1140your VMWare image to work correctly with STAF/STAX.  The "stopvmware"
1141function shuts down and powers off a VMWare image.  The "main" function
1142shows how you call the vmware functions.  In your main function, after
1143the VMWare image has booted (you would need to wait for an appropriate
1144amount of time and do a STAF PING to the machine to determine that it's
1145up and running), you would begin running your tests on the VMWare image.
1146</p><div class="example"><a name="d0e777"></a><p class="title"><b>Example&nbsp;8.&nbsp;Using STAF/STAX to boot VMWare images and then execute tests</b></p><pre class="programlisting">
1147&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
1148&lt;!DOCTYPE stax SYSTEM "stax.dtd"&gt;
1149
1150&lt;stax&gt;
1151
1152  &lt;defaultcall function="main"/&gt;
1153
1154  &lt;function name="main" scope="local"&gt;
1155
1156    &lt;parallel&gt;
1157
1158      &lt;block name="'Boot up VMWare image'"&gt;
1159        &lt;call function="'startvmware'"&gt;
1160          { 'image': 'c:/vmware/winxp/Windows-XP-Professional.vmx',
1161            'timeout' : '5m', 'imagehostname' : 'abcdef',
1162            'imagename' : 'Windows XP Professional'
1163          }
1164        &lt;/call&gt;
1165      &lt;/block&gt;
1166
1167      &lt;block name="'Release this block to shutdown the VMWare image'"&gt;
1168        &lt;sequence&gt;
1169
1170          &lt;hold/&gt;
1171
1172          &lt;call function="'stopvmware'"&gt;
1173            { 'imagehostname' : 'abcdef', 'shutdown' : 'shutdown -s -f -t 0' }
1174          &lt;/call&gt;
1175
1176        &lt;/sequence&gt;
1177      &lt;/block&gt;
1178
1179    &lt;/parallel&gt;
1180
1181  &lt;/function&gt;
1182
1183  &lt;function name="startvmware" scope="local"&gt;
1184
1185    &lt;function-prolog&gt;
1186      Starts a VMWare image, and attempts to do a STAF PING to the VMWare image.
1187      Your VMWare image needs to be configured so that there are no popups
1188      displayed when the VMWare image starts (for example, messages about Disk
1189      Drive warnings, etc), and that the image is set up to automatically log
1190      in.  Also, the machine must be configured to start STAF automatically.
1191      Also, you must have the following 2 lines in your VMWare image's .vmx file:
1192
1193      gui.exitOnCLIHLT = "TRUE"
1194      gui.exitAtPowerOff = "TRUE"
1195
1196      Note that you should avoid terminating any blocks that are running a VMWare
1197      image, as that will kill the VMWare image without it being shutdown.  Instead,
1198      you should manually shutdown and power off the VMWare image, or call the
1199      "terminatevmware" [not yet implemented] function.
1200
1201      You should use Bridged network connections for VMWare images to work
1202      correctly with this function.
1203
1204    &lt;/function-prolog&gt;
1205
1206    &lt;function-map-args&gt;
1207
1208      &lt;function-optional-arg name="machine" default="'local'"&gt;
1209        The machine on which the VMWare image is to be started.  The default is 'local'.
1210      &lt;/function-optional-arg&gt;
1211
1212      &lt;function-optional-arg name="vmwarebin" default="'c:/Program Files/Vmware/VMware Workstation/vmware.exe'"&gt;
1213        The VMWare executable file.  If the VMWare executable is not in the
1214        VMWare system's PATH, then the file must be fully qualified.
1215        The default is 'c:/Program Files/Vmware/VMware Workstation/vmware.exe'.
1216      &lt;/function-optional-arg&gt;
1217
1218      &lt;function-required-arg name="image"&gt;
1219        The fully qualified VMWare .vmx file for the VMWare image.  Note that
1220        the VMWare executable does not permit spaces in the file name of the
1221        vmx file.
1222      &lt;/function-required-arg&gt;
1223
1224      &lt;function-required-arg name="imagehostname"&gt;
1225        The hostname for the VMWare image.
1226      &lt;/function-required-arg&gt;
1227
1228      &lt;function-optional-arg name="timeout" default="'10m'"&gt;
1229        The timeout value for when the function should stop attempting to
1230        STAF PING the VMWare image. The default is 10 minutes.  The STAF PING
1231        to the VMWare image will be attempted every 30 seconds, up to the
1232        timeout value.
1233      &lt;/function-optional-arg&gt;
1234
1235      &lt;function-optional-arg name="imagename" default='image'&gt;
1236        The name of the VMWare image.  The default is the argument specified
1237        for image.
1238      &lt;/function-optional-arg&gt;
1239
1240    &lt;/function-map-args&gt;
1241
1242    &lt;parallel&gt;
1243
1244      &lt;process name="'VMWare Image %s ' % imagename"&gt;
1245        &lt;location&gt;machine&lt;/location&gt;
1246        &lt;command&gt;vmwarebin&lt;/command&gt;
1247        &lt;parms&gt;'-x -q %s' % image&lt;/parms&gt;  &lt;!-- -x powers on automatically, -q exits at power off --&gt;
1248        &lt;stdout&gt;'out.txt'&lt;/stdout&gt;
1249        &lt;stderr mode="'stdout'"/&gt;
1250        &lt;returnstdout/&gt;
1251      &lt;/process&gt;
1252
1253      &lt;sequence&gt;
1254
1255        &lt;script&gt;contacted = 0&lt;/script&gt;
1256
1257        &lt;timer duration='timeout'&gt;
1258
1259          &lt;loop while="contacted == 0"&gt;
1260
1261            &lt;sequence&gt;
1262
1263              &lt;stafcmd name="'Delaying for 30 seconds'"&gt;
1264                &lt;location&gt;'local'&lt;/location&gt;
1265                &lt;service&gt;'delay'&lt;/service&gt;
1266                &lt;request&gt;'delay 30000'&lt;/request&gt;
1267              &lt;/stafcmd&gt;
1268
1269              &lt;stafcmd name = "'Attempt to ping %s' % imagehostname"&gt;
1270                &lt;location&gt;imagehostname&lt;/location&gt;
1271                &lt;service&gt;'ping'&lt;/service&gt;
1272                &lt;request&gt;'ping'&lt;/request&gt;
1273              &lt;/stafcmd&gt;
1274
1275              &lt;if expr="RC == 0"&gt;
1276                &lt;sequence&gt;
1277                  &lt;script&gt;contacted = 1&lt;/script&gt;
1278                  &lt;message&gt;'Machine %s is up and running with VMWare image %s' % (imagehostname, imagename)&lt;/message&gt;
1279                  &lt;log&gt;'Machine %s is up and running with VMWare image %s' % (imagehostname, imagename)&lt;/log&gt;
1280                &lt;/sequence&gt;
1281              &lt;/if&gt;
1282
1283            &lt;/sequence&gt;
1284
1285          &lt;/loop&gt;
1286
1287        &lt;/timer&gt;
1288
1289        &lt;if expr="RC != 0"&gt;
1290          &lt;sequence&gt;
1291            &lt;message&gt;'Machine %s with VMWare image %s was not successfully started RC: %s' % (imagehostname, imagename, RC)&lt;/message&gt;
1292            &lt;log&gt;'Machine %s with VMWare image %s was not successfully started RC: %s' % (imagehostname, imagename, RC)&lt;/log&gt;
1293          &lt;/sequence&gt;
1294        &lt;/if&gt;
1295
1296      &lt;/sequence&gt;
1297
1298    &lt;/parallel&gt;
1299
1300  &lt;/function&gt;
1301
1302  &lt;function name="stopvmware" scope="local"&gt;
1303
1304    &lt;function-prolog&gt;
1305      Stops a VMWare image
1306    &lt;/function-prolog&gt;
1307
1308    &lt;function-map-args&gt;
1309
1310      &lt;function-required-arg name="imagehostname"&gt;
1311        The hostname for the VMWare image.
1312      &lt;/function-required-arg&gt;
1313
1314      &lt;function-required-arg name="shutdown"&gt;
1315        The command used to shut down the OS.
1316      &lt;/function-required-arg&gt;
1317
1318    &lt;/function-map-args&gt;
1319
1320    &lt;sequence&gt;
1321
1322      &lt;script&gt;
1323          from com.ibm.staf import STAFUtil
1324      &lt;/script&gt;
1325
1326      &lt;stafcmd&gt;
1327        &lt;location&gt;imagehostname&lt;/location&gt;
1328        &lt;service&gt;'process'&lt;/service&gt;
1329        &lt;request&gt;'start async shell command %s' % STAFUtil.wrapData(shutdown)&lt;/request&gt;
1330      &lt;/stafcmd&gt;
1331
1332    &lt;/sequence&gt;
1333
1334  &lt;/function&gt;
1335
1336&lt;/stax&gt;
1337</pre></div></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e782"></a><a name="d0e783"></a><b>2.6.7.</b></td><td align="left" valign="top"><p>
1338How can I parse an XML file from a STAX job?
1339</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1340A STAX job can parse an XML file using an XML Parser of your choice.
1341Below is a example that demonstrates how to do this using an XML Parser
1342provided with java.  This example parses an XML file whose name you
1343specify and also validates the xml file.  In this example, it's parsing a
1344STAX xml file so it's using the STAX DTD but you could specify another
1345DTD).  This example also provides xml parsing error information, including
1346the line number and xml parsing error message.
1347</p><div class="example"><a name="d0e789"></a><p class="title"><b>Example&nbsp;9.&nbsp;Parsing an XML File from a STAX job</b></p><pre class="programlisting">
1348&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
1349&lt;!DOCTYPE stax SYSTEM "stax.dtd"&gt;
1350
1351&lt;stax&gt;
1352
1353  &lt;defaultcall function="Main"/&gt;
1354
1355  &lt;function name="Main"&gt;
1356
1357    &lt;sequence&gt;
1358
1359      &lt;!-- Assign the file name of a STAX xml document you want to parse --&gt;
1360      &lt;call function="'parseXML'"&gt;'c:/dev/src/stax/leTest.xml'&lt;/call&gt;
1361
1362      &lt;script&gt;
1363        document = STAXResult
1364
1365        # Change code here to parse the document as you desire.
1366        # The code shown here is just an example for parsing a STAX xml document
1367
1368        root = document.getDocumentElement()
1369        children = root.getChildNodes()
1370
1371        msg = ''
1372
1373        for i in range(children.getLength()):
1374          thisChild = children.item(i);
1375
1376          if (thisChild.getNodeType() == Node.ELEMENT_NODE and
1377              thisChild.getNodeName() == 'defaultcall'):
1378            msg = '%s\nFound defaultcall element' % (msg)
1379          elif thisChild.getNodeType() == Node.COMMENT_NODE:
1380            # Do nothing
1381            continue
1382          elif thisChild.getNodeType() == Node.ELEMENT_NODE:
1383            msg = '%s\nFound %s element' % (msg, thisChild.getNodeName())
1384      &lt;/script&gt;
1385
1386      &lt;message&gt;'Some parsed data: %s' % (msg)&lt;/message&gt;
1387      &lt;log&gt;'Some parsed data: %s' % (msg)&lt;/log&gt;
1388
1389    &lt;/sequence&gt;
1390  &lt;/function&gt;
1391
1392  &lt;!-- ******************************************************************* --&gt;
1393  &lt;!-- Following function is used to parse an XML file and return the DOM  --&gt;
1394  &lt;!-- document object                                                     --&gt;
1395  &lt;!-- ******************************************************************* --&gt;
1396  &lt;function name="parseXML" scope="local"&gt;
1397
1398    &lt;function-list-args&gt;
1399      &lt;function-required-arg name="xmlFileName"&gt;
1400        Name of file containing XML to be parsed
1401      &lt;/function-required-arg&gt;
1402    &lt;/function-list-args&gt;
1403
1404    &lt;sequence&gt;
1405
1406      &lt;!-- Parse the XML --&gt;
1407      &lt;script&gt;
1408        factory = DocumentBuilderFactory.newInstance();
1409        factory.setValidating(1)
1410        factory.setIgnoringElementContentWhitespace(0)
1411
1412        try:
1413          parseError    = 0
1414          builder  = factory.newDocumentBuilder()
1415          resolver = ParserResolver()
1416          builder.setEntityResolver(resolver)
1417          builder.setErrorHandler(resolver)
1418          document = builder.parse(xmlFileName)
1419        except SAXParseException, spe:
1420          parseError = 1
1421      &lt;/script&gt;
1422
1423      &lt;!-- Quit if there is any parsing error --&gt;
1424      &lt;if expr="parseError"&gt;
1425        &lt;sequence&gt;
1426          &lt;script&gt;
1427            errmsg = 'Error occurred parsing file %s\n  line: %s\n  msg: %s' % (
1428              xmlFileName, spe.getLineNumber(), spe.getMessage())
1429          &lt;/script&gt;
1430          &lt;log&gt;errmsg&lt;/log&gt;
1431          &lt;message&gt;errmsg&lt;/message&gt;
1432          &lt;terminate/&gt;
1433        &lt;/sequence&gt;
1434      &lt;/if&gt;
1435
1436      &lt;return&gt;document&lt;/return&gt;
1437
1438    &lt;/sequence&gt;
1439  &lt;/function&gt;
1440
1441  &lt;script&gt;
1442
1443    # These imports only need to be done once per job, no matter
1444    # how many xml documents are parsed
1445
1446    from java.io import File
1447    from java.io import StringReader
1448    from org.xml.sax import InputSource
1449    from org.xml.sax import SAXParseException
1450    from org.xml.sax.helpers import DefaultHandler
1451    from javax.xml.parsers import DocumentBuilderFactory
1452    from javax.xml.parsers import DocumentBuilder
1453    from org.w3c.dom import Document
1454    from org.w3c.dom import Element
1455    from org.w3c.dom import Node
1456    from org.w3c.dom import NodeList
1457
1458    # Name of file containing STAX DTD (or whatever DTD you want used) to
1459    # when validating/parsing an xml file
1460    dtdFileName = 'C:/stax.dtd'
1461
1462    # ************************************************************************ #
1463    # Following are the private Python classes                                 #
1464    # ************************************************************************ #
1465
1466    # This class handles XML Parsing exceptions
1467    class ParserException(Exception):
1468        pass
1469
1470    # This class handles the exception raised by XML parser
1471    class ParserResolver(DefaultHandler):
1472        def resolveEntity (self, publicId, systemId):
1473            return InputSource(dtdFileName)
1474        def error (self, e):
1475            raise 'error', e
1476        def warning (self, e):
1477            raise 'warning', e
1478        def fatalError (self, e):
1479            raise 'fatal', e
1480  &lt;/script&gt;
1481
1482&lt;/stax&gt;
1483</pre></div></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e794"></a><h4 class="title"><a name="d0e794"></a>2.7. Globalization</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>2.7.1. <a href="#d0e797">
1484How do I use STAF/STAX in environments where machines running STAF have
1485different locales?
1486</a></dt><dt>2.7.2. <a href="#d0e814">
1487How do I specify non-ASCII characters in a STAF request or STAX job?
1488</a></dt><dt>2.7.3. <a href="#d0e855">
1489How do I know what codepage STAF is using on my machine?
1490</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e797"></a><a name="d0e798"></a><b>2.7.1.</b></td><td align="left" valign="top"><p>
1491How do I use STAF/STAX in environments where machines running STAF have
1492different locales?
1493</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1494In general, you don't have to do anything special.
1495</p><p>
1496The requests submitted to STAF and the results received from STAF are all
1497strings. These strings may contain any arbitrary set of characters, including
1498the NULL (i.e., 0) character. When working in an environment with a
1499heterogeneous set of codepages, STAF will translate the request and result
1500strings from and to the necessary codepages. This ensures that the request
1501and result strings are not misinterpreted by the receiver.
1502</p><p>
1503In general, when using STAF services, there shouldn't be any round trip
1504problems. "Round trip" in this context means when all requests are originating
1505from the same system, even if the requests are sent to, and the data is stored
1506on, a system with a different codepage. However, if you send, for example, a
1507request to log data containing Japanese codepage specific characters to any
1508system and then query the log from a system using a US English codepage, you
1509won't get the "correct" data, as that is not a valid "round trip".
1510</p><p>
1511Note: All STAF generated strings are composed of only ASCII-7 characters and
1512will safely survive the translation from/to different codepages.
1513</p><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3><p>
1514If you use a STAF service that is written in REXX, it can have round trip
1515codepage translation problems. All of STAF services currently provided are
1516written in C++/Java so they do not have this problem.
1517</p></div><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e814"></a><a name="d0e815"></a><b>2.7.2.</b></td><td align="left" valign="top"><p>
1518How do I specify non-ASCII characters in a STAF request or STAX job?
1519</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1520If you're specifying a STAF request from the command line, then you can
1521just specify the appropriate characters.
1522</p><div class="example"><a name="d0e821"></a><p class="title"><b>Example&nbsp;10.&nbsp;
1523Specifying a French character in a STAF request submitted via the command line
1524</b></p><pre class="screen">
1525<span><b class="command">STAF frenchMach PROCESS START COMMAND c:/test/TestA PARMS "-server fran&ccedil;ais"</b></span>
1526</pre></div><p>
1527</p><p>
1528If you want to specify non-ASCII characters in a STAX job, then you need to
1529specify them in Unicode.
1530</p><div class="example"><a name="d0e832"></a><p class="title"><b>Example&nbsp;11.&nbsp;Specifying a French character in Unicode in a STAX job</b></p><pre class="programlisting">
1531  &lt;process&gt;
1532    &lt;location&gt;'frenchMach'&lt;/location&gt;
1533    &lt;command&gt;'c:/test/TestA'&lt;/command&gt;
1534    &lt;parms&gt;'-server fran' + u'\u00E7' + 'ais'&lt;/parms&gt;
1535  &lt;/process&gt;
1536</pre></div><p>
1537</p><div class="example"><a name="d0e838"></a><p class="title"><b>Example&nbsp;12.&nbsp;Specifying Chinese characters in Unicode in a STAX job</b></p><pre class="programlisting">
1538  &lt;script&gt;dirName = '/tmp/Sun2_' + u'\u4F3A\u670D\u5668'&lt;/script&gt;
1539
1540  &lt;stafcmd&gt;
1541    &lt;location&gt;'chineseMach'&lt;/location&gt;
1542    &lt;service&gt;'FS'&lt;/service&gt;
1543    &lt;request&gt;'CREATE DIRECTORY %s' % (dirName)&lt;/request&gt;
1544  &lt;/stafcmd&gt;
1545</pre></div><p>
1546</p><p>
1547If you want to specify non-ASCII characters in a STAF request submitted
1548via a Java program, then you need to specify them in Unicode.
1549</p><div class="example"><a name="d0e846"></a><p class="title"><b>Example&nbsp;13.&nbsp;Specifying Chinese characters in Unicode in a PROCESS START request
1550via a Java program</b></p><pre class="programlisting">
1551  String machine    = "chineseMach";
1552  String service    = "PROCESS";
1553  String serverName = "\u4F3A\u670D\u5668_HP";
1554  String request    = "START COMMAND " + STAFUtil.wrapData("/test/startServer.sh") +
1555                      " PARMS " + STAFUtil.wrapData(serverName) + " WAIT";
1556  STAFResult submitResult = handle.submit2(machine, service, request);
1557</pre></div><p>
1558</p><p>
1559If you need to specify non-ASCII characters in a request, then you need to be
1560aware of some anomalies if your target system is a Windows system that isn't
1561using an English codepage and whose ANSI codepage (ACP) identifier is different
1562from the OEM codepage (OEMCP) identifier.  The system locale determines which
1563codepages are defaults for the Windows system. However, some European locales
1564such as French and German set different values for the ACP and OEMCP.
1565See section "2.7.1 Windows Codepage Translation Anomalies" in
1566the STAF User's Guide for more information on these Windows codepage
1567translation anomalies.
1568</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e855"></a><a name="d0e856"></a><b>2.7.3.</b></td><td align="left" valign="top"><p>
1569How do I know what codepage STAF is using on my machine?
1570</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1571To see the codepage that STAF is using, check the value of STAF
1572variable STAF/Config/CodePage. For example:
1573</p><pre class="screen">
1574<span><b class="command">STAF testmach1 VAR RESOLVE STRING {STAF/Config/CodePage}</b></span>
1575</pre><p>
1576</p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e869"></a><h3 class="title"><a name="d0e869"></a>3. Debugging STAF</h3></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>3.1.  <a href="#d0e872">General Questions</a></dt><dd><dl><dt>3.1.1. <a href="#d0e875">
1577What should I do if I'm having a problem with STAF or one of its services?
1578</a></dt><dt>3.1.2. <a href="#d0e904">What information should I include when asking questions or reporting bugs?</a></dt><dt>3.1.3. <a href="#d0e934">
1579Explain RC 16 when attempting to send a STAF request to a remote machine
1580</a></dt><dt>3.1.4. <a href="#STAF machines can't communicate due to DNS issues">
1581Why can't my STAF machines communicate?
1582</a></dt><dt>3.1.5. <a href="#d0e1132">
1583Why aren't my entries in /etc/hosts being used for STAF communication (particularly on Linux SLES)?
1584</a></dt><dt>3.1.6. <a href="#d0e1151">
1585Why can't I use the HELP service when STAF is not running?
1586</a></dt><dt>3.1.7. <a href="#d0e1167">
1587Why are there are more STAF processes on Linux?
1588</a></dt><dt>3.1.8. <a href="#d0e1183">
1589Why am I having problems (such as an RC 6) submitting a request to a Java service?
1590</a></dt><dt>3.1.9. <a href="#d0e1202">
1591Why is STAFProc terminating on some Unix platforms (such as Solaris)
1592when the STAFProc terminal is exited?
1593</a></dt><dt>3.1.10. <a href="#d0e1229">
1594Why don't I see any Java service output in the STAFProc console anymore?
1595</a></dt><dt>3.1.11. <a href="#d0e1257">
1596When using Sun Java 1.4.2, why are the -Xmx settings for my Java STAF service
1597not being used?
1598</a></dt><dt>3.1.12. <a href="#d0e1267">
1599Explain RC 21 when running staf local ping ping on
1600Unix platforms.
1601</a></dt><dt>3.1.13. <a href="#Error accepting on server socket, socket RC: 24">Explain "Error accepting on server socket,socket RC: 24"</a></dt><dt>3.1.14. <a href="#Error using STAF Java libraries on Linux: libJSTAF.so: undefined symbol: _ZNSt8ios_base4InitD1Ev">Explain error using STAF Java libraries on Linux: libJSTAF.so: undefined symbol: _ZNSt8ios_base4InitD1Ev"</a></dt><dt>3.1.15. <a href="#Slow performance sending a STAF PING request to a remote machine">Why is the performance slow when sending a STAF PING request to a remote machine?</a></dt><dt>3.1.16. <a href="#Why does a request to the LOG, MONITOR, RESPOOL, or ZIP service fail with RC 2 (Unknown service)">Why does a request to the LOG, MONITOR, RESPOOL, or ZIP service fail with RC 2 (Unknown service)?</a></dt></dl></dd><dt>3.2.  <a href="#d0e1368">STAF Install Questions</a></dt><dd><dl><dt>3.2.1. <a href="#d0e1371">
1602If the InstallAnywhere installer fails, how do I get debug information?
1603</a></dt><dt>3.2.2. <a href="#d0e1381">What if AIX STAF environment variables (PATH, LIBPATH, etc.) are not set when opening a terminal?</a></dt><dt>3.2.3. <a href="#d0e1393">
1604When running STAFInst on Solaris, why does it fail with "test: unknown
1605operator -ef"?
1606</a></dt><dt>3.2.4. <a href="#d0e1410">
1607Explain message "JAR Archive failed security check corrupt JAR file" when
1608trying to download a STAF jar file
1609</a></dt><dt>3.2.5. <a href="#d0e1418">
1610Why does the STAF InstallAnywhere install fail on RHEL5?
1611</a></dt><dt>3.2.6. <a href="#d0e1431">
1612What entries do I need for STAF in my /etc/profile file if I am using the
1613STAF tar.gz installation?
1614</a></dt></dl></dd><dt>3.3.  <a href="#d0e1442">STAF Startup Questions</a></dt><dd><dl><dt>3.3.1. <a href="#d0e1445">Explain startup error: Error constructing service, JSTAF</a></dt><dt>3.3.2. <a href="#d0e1479">Explain startup error: Error binding server socket, bind() RC=98 (or 67)</a></dt><dt>3.3.3. <a href="#d0e1550">Explain startup error: Error binding server socket, bind() RC=10048</a></dt><dt>3.3.4. <a href="#d0e1573">
1615Explain startup error: 38:Illegal access to class: com.ibm.staf.service....
1616</a></dt><dt>3.3.5. <a href="#d0e1583">
1617Why does STAF's user registration fail each time STAFProc is started?
1618</a></dt><dt>3.3.6. <a href="#d0e1591">
1619Explain startup error:  Error initializing service, RESPOOL. RC: 4008
1620</a></dt><dt>3.3.7. <a href="#d0e1601">What should I do if STAF fails to init with Windows Terminal Server?</a></dt><dt>3.3.8. <a href="#d0e1611">
1621On SLES8, why do I get an error starting STAF: STAFProc:
1622/usr/lib/libstdc++.so.5: version `GLIBCPP_3.2.2' not found (required by
1623STAFProc)
1624</a></dt><dt>3.3.9. <a href="#d0e1619">
1625Explain startup error on z/OS: Error binding server socket, bind() RC=1115
1626</a></dt><dt>3.3.10. <a href="#d0e1629">Explain startup error: RC: 27, Error initializing service, JSTAF when using a
1627GNU compiler for Java provided with Linux</a></dt><dt>3.3.11. <a href="#d0e1643">Explain HPUX error "sh: SHLIB_PATH: Parameter not set." when running
1628/usr/local/staf/STAFEnv.sh, or when running it via sourcing .profile)</a></dt><dt>3.3.12. <a href="#d0e1651">When logged into the desktop on RHEL4-U4, if I run "STAFProc" or
1629"STAF", I get "error while loading shared libraries: libSTAF.so".</a></dt><dt>3.3.13. <a href="#d0e1669">Explain AIX error "Symbol XX__Q2_3std8ios_base is not exported from
1630dependent module /usr/lib/libC.a"</a></dt><dt>3.3.14. <a href="#d0e1694">
1631Explain HPUX IA64 error /usr/lib/hpux32/dld.so: Unsatisfied code symbol
1632'__cxa_get_exception_ptr' in load module './STAFProc'.
1633</a></dt><dt>3.3.15. <a href="#d0e1716">
1634On Windows x86_64), explain error OS RC 14001: This application has failed to start
1635because the application configuration is incorrect..
1636</a></dt><dt>3.3.16. <a href="#d0e1735">
1637Explain Linux error "STAFProc: relocation error: undefined
1638symbol: _ZNSs4_Rep20_S_empty_rep_storageE" when starting STAFProc.
1639</a></dt><dt>3.3.17. <a href="#d0e1768">
1640Explain Solaris Sparc 64-bit error when starting STAFProc:
1641"/usr/sfw/lib/libstdc++.so.6: wrong ELF class: ELFCLASS32".
1642</a></dt><dt>3.3.18. <a href="#d0e1785">
1643Explain startup error: Error creating interface.  Could not determine
1644logical/physical identifier.
1645</a></dt></dl></dd><dt>3.4.  <a href="#d0e1802">PROCESS Service Questions</a></dt><dd><dl><dt>3.4.1. <a href="#d0e1805">Explain RC 10 when attempting to run a process</a></dt><dt>3.4.2. <a href="#d0e1825">Explain RC 25 when starting a process on a remote machine</a></dt><dt>3.4.3. <a href="#d0e1840">Explain why I'm having a problem interacting with process queues for
1646processes started via the command line</a></dt><dt>3.4.4. <a href="#d0e1902">Why are child processes not killed on Windows?</a></dt><dt>3.4.5. <a href="#d0e1916">
1647Why can't a STAF process log its output to an AFS directory?
1648</a></dt><dt>3.4.6. <a href="#d0e1924">
1649Why do I get a SIGABRT after a STAF process has completed on HP-UX?
1650</a></dt><dt>3.4.7. <a href="#d0e1940">
1651Explain error message: "STAFProcessManager::processMonitorThread: Parent
1652could not set child's pgid: 13"
1653</a></dt><dt>3.4.8. <a href="#d0e1948">
1654Explain Unix error message: STAFProcessManager::processMonitorThread: Could not
1655start process (execve): 8
1656</a></dt><dt>3.4.9. <a href="#d0e1956">
1657When running the ftp executable for Windows via a PROCESS START request, why aren't I getting the remote server responses in stdout?
1658</a></dt><dt>3.4.10. <a href="#d0e1982">Why do Expect scripts fail on Linux when STAFProc has been started
1659during system reboot?</a></dt><dt>3.4.11. <a href="#d0e2017">Why is different output returned by some commands such as "reg query"
1660when run using a win32 version of STAF on a Windows 64-bit system?</a></dt></dl></dd><dt>3.5.  <a href="#d0e2050">FS Service Questions</a></dt><dd><dl><dt>3.5.1. <a href="#d0e2053">Why does COPY FILE request fail when no TOMACHINE is specified?</a></dt><dt>3.5.2. <a href="#d0e2090">
1661Why are my text files copied via the FS service not converted correctly
1662between Windows and Unix?
1663</a></dt><dt>3.5.3. <a href="#d0e2098">
1664Why can't I copy a file that is larger then 4GB?
1665</a></dt><dt>3.5.4. <a href="#d0e2111">
1666Why does FS LIST COPYREQUESTS show a copy request in progress on the destination machine
1667that has already failed with a RC 22?
1668</a></dt></dl></dd></dl></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e872"></a><h4 class="title"><a name="d0e872"></a>3.1. General Questions</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>3.1.1. <a href="#d0e875">
1669What should I do if I'm having a problem with STAF or one of its services?
1670</a></dt><dt>3.1.2. <a href="#d0e904">What information should I include when asking questions or reporting bugs?</a></dt><dt>3.1.3. <a href="#d0e934">
1671Explain RC 16 when attempting to send a STAF request to a remote machine
1672</a></dt><dt>3.1.4. <a href="#STAF machines can't communicate due to DNS issues">
1673Why can't my STAF machines communicate?
1674</a></dt><dt>3.1.5. <a href="#d0e1132">
1675Why aren't my entries in /etc/hosts being used for STAF communication (particularly on Linux SLES)?
1676</a></dt><dt>3.1.6. <a href="#d0e1151">
1677Why can't I use the HELP service when STAF is not running?
1678</a></dt><dt>3.1.7. <a href="#d0e1167">
1679Why are there are more STAF processes on Linux?
1680</a></dt><dt>3.1.8. <a href="#d0e1183">
1681Why am I having problems (such as an RC 6) submitting a request to a Java service?
1682</a></dt><dt>3.1.9. <a href="#d0e1202">
1683Why is STAFProc terminating on some Unix platforms (such as Solaris)
1684when the STAFProc terminal is exited?
1685</a></dt><dt>3.1.10. <a href="#d0e1229">
1686Why don't I see any Java service output in the STAFProc console anymore?
1687</a></dt><dt>3.1.11. <a href="#d0e1257">
1688When using Sun Java 1.4.2, why are the -Xmx settings for my Java STAF service
1689not being used?
1690</a></dt><dt>3.1.12. <a href="#d0e1267">
1691Explain RC 21 when running staf local ping ping on
1692Unix platforms.
1693</a></dt><dt>3.1.13. <a href="#Error accepting on server socket, socket RC: 24">Explain "Error accepting on server socket,socket RC: 24"</a></dt><dt>3.1.14. <a href="#Error using STAF Java libraries on Linux: libJSTAF.so: undefined symbol: _ZNSt8ios_base4InitD1Ev">Explain error using STAF Java libraries on Linux: libJSTAF.so: undefined symbol: _ZNSt8ios_base4InitD1Ev"</a></dt><dt>3.1.15. <a href="#Slow performance sending a STAF PING request to a remote machine">Why is the performance slow when sending a STAF PING request to a remote machine?</a></dt><dt>3.1.16. <a href="#Why does a request to the LOG, MONITOR, RESPOOL, or ZIP service fail with RC 2 (Unknown service)">Why does a request to the LOG, MONITOR, RESPOOL, or ZIP service fail with RC 2 (Unknown service)?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e875"></a><a name="d0e876"></a><b>3.1.1.</b></td><td align="left" valign="top"><p>
1694What should I do if I'm having a problem with STAF or one of its services?
1695</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1696If you are having a problem with STAF or one of its services, follow these
1697steps to resolve the problem:
1698</p><div class="orderedlist"><ol type="1"><li><p>
1699View the topics listed in this FAQ to determine if any of the topics can help
1700you to resolve the problem.
1701</p></li><li><p>
1702View the
1703<a href="http://sourceforge.net/p/staf/bugs/" target="_top">
1704STAF Bugs</a> to see if the problem has already been reported.
1705</p></li><li><p>
1706If you are not sure if the problem is a STAF bug, then post a question to
1707the <a href="http://sourceforge.net/p/staf/discussion" target="_top">STAF
1708Help forum</a>.
1709</p><p>
1710If you are fairly certain that this is a bug with STAF or one of its services,
1711then
1712<a href="http://sourceforge.net/p/staf/bugs/new/" target="_top">
1713Submit a new Bug</a>.
1714</p></li></ol></div><p>
1715</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e904"></a><a name="d0e905"></a><b>3.1.2.</b></td><td align="left" valign="top"><p>What information should I include when asking questions or reporting bugs?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1716When you are posting to the Help forum or submitting a new bug, the STAF
1717development team will be better able to quickly resolve your problem if you
1718supply the following information:
1719</p><div class="itemizedlist"><ul type="disc"><li>
1720The OS platform and version number
1721</li><li>
1722The version of STAF that you are running.  The version is displayed
1723when you start STAFProc ("STAFProc version 3.2.0 initialized").
1724</li><li>
1725If you are having a problem with a STAF service, include the service's
1726version number (this can be obtained by typing:
1727<span><b class="command">staf local <i class="replaceable"><tt>service</tt></i> version"</b></span>)
1728</li><li>
1729If you can't start STAFProc due to an error in the STAF configuration file,
1730include the entire contents of the STAF.cfg file.
1731</li><li>
1732If you are having a problem with a Java STAF service, include the Java version
1733(this can be obtained by typing: <span><b class="command">java -version</b></span>) and
1734include any errors in the JVM log for the Java STAF service
1735(located in {STAF/DataDir}/lang/java/jvm/&lt;JVMName&gt;/JVMLog.1).
1736</li><li>
1737If you are having a problem installing STAF, include the type of installation
1738where the problem occurs (InstallAnywhere executable, GNU zipped tar).
1739</li></ul></div><p>
1740</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e934"></a><a name="d0e935"></a><b>3.1.3.</b></td><td align="left" valign="top"><p>
1741Explain RC 16 when attempting to send a STAF request to a remote machine
1742</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1743Return code of 16 means "No Path To Endpoint". This means that STAF could
1744not talk to the target system, with likely causes being:
1745</p><div class="itemizedlist"><ul type="disc"><li>
1746STAF is not running on the target system.
1747</li><li>
1748An invalid or unreachable endpoint (e.g. an invalid hostname or IP address) was specified.
1749</li><li>
1750The network interface or port specified in the endpoint is not supported
1751on the target system.  The network interfaces are configured in the STAF.cfg file
1752and can be listed by submitting a <span><b class="command">LIST INTERFACES</b></span> request
1753to the MISC service.
1754</li><li>
1755A firewall is blocking communication via the STAF TCP/IP port configured for the
1756network interface in your STAF.cfg.  Note that the default STAF TCP/IP port is 6500.
1757</li><li>
1758The DNS on one of the machines is not set up correctly.
1759Refer to <a href="#STAF machines can't communicate due to DNS issues">
1760"Why can't my STAF machines communicate?"</a>.
1761</li><li>
1762You may need to increase your CONNECTTIMEOUT value for the
1763network interface and/or increase your CONNECTATTEMPTS value in your STAF.cfg file.
1764</li></ul></div><p>
1765</p></td></tr><tr class="question"><td align="left" valign="top"><a name="STAF machines can't communicate due to DNS issues"></a><a name="d0e962"></a><b>3.1.4.</b></td><td align="left" valign="top"><p>
1766Why can't my STAF machines communicate?
1767</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1768If you are having problems getting two STAF machines to communicate,
1769try the following steps on each machine:
1770</p><div class="itemizedlist"><ul type="disc"><li><p>
1771On each machine, run <span><b class="command">ping <i class="replaceable"><tt>other-machine
1772hostname</tt></i></b></span> to determine if the machines can communicate.
1773</p></li><li><p>
1774On <i class="replaceable"><tt>machine1</tt></i>, get the output from:
1775</p><pre class="screen">
1776<span><b class="command">staf local var resolve string {STAF/Config/Machine}</b></span>
1777</pre><p>
1778</p></li><li><p>
1779Then, on <i class="replaceable"><tt>machine2</tt></i>, run:
1780</p><pre class="screen">
1781<span><b class="command">staf <i class="replaceable"><tt>machine1-var</tt></i> ping ping</b></span>
1782</pre><p>
1783where <i class="replaceable"><tt>machine1-var</tt></i> is the output from the
1784<span><b class="command">var resolve</b></span>.
1785</p><p>
1786If the ping does not work (in either direction), then you need to update
1787the DNS settings so that the machines can communicate.
1788</p><p>
1789</p></li></ul></div><p>
1790</p><div class="procedure"><p class="title"><b>Procedure&nbsp;2.&nbsp;Changing the DNS settings on Windows 2000</b></p><ol type="1"><li>
1791From the "Start" menu, select "Network and Dialup Connections" and then
1792select "Local Area Connection"
1793</li><li>
1794Then click on "Properties" and select "Internet Protocol (TCP/IP)" and
1795click on "Properties"
1796</li><li>
1797Next, click on "Advanced" and make sure that the field for "DNS suffix
1798for this connection:" shows the correct domain name (such as "austin.ibm.com")
1799</li><li>
1800Another thing to verify is the Network Identification.  From the "Start"
1801menu, select "Settings" and then "Control Panel"
1802</li><li>
1803Next, select "System" and then select the "Network Identification" tab
1804</li><li>
1805Then click on "Properties" and make sure that the "Computer name:" is correct
1806</li><li>
1807Then click on "More" and make sure that the "Primary DNS suffix of this
1808computer shows the correct domain name (such as "austin.ibm.com")
1809</li></ol></div><div class="procedure"><p class="title"><b>Procedure&nbsp;3.&nbsp;Changing the DNS settings on Windows XP</b></p><ol type="1"><li>
1810From the "Start" menu, select "Network Connections" and then select your
1811Local Area Connection
1812</li><li>
1813Then click on "Properties" and select "Internet Protocol (TCP/IP)" and
1814click on "Properties"
1815</li><li>
1816Next, click on "Advanced" and then the "DNS" tab.  Make sure that
1817the field for "DNS suffix for this connection:" shows the correct domain
1818name (such as "austin.ibm.com")
1819</li><li>
1820The second place to verify is the Computer Name.  From the "Start"
1821menu, select "Control Panel"
1822</li><li>
1823Next, select "System" and then select the "Computer Name" tab
1824</li><li>
1825Then click on "Change" and make sure that the "Computer name:" is correct
1826</li><li>
1827Then click on "More" and make sure that the "Primary DNS suffix of this
1828computer" shows the correct domain name (such as "austin.ibm.com")
1829</li></ol></div><p>
1830The following paragraph only applies to IBM users of STAF/STAX.  If
1831you are running a Windows e-business client, and other machines can't ping
1832the e-business client, it is likely that the e-business client is running
1833"Net Firewall", which disables the ability of other machines to ping the
1834e-business client (which also means that STAFProc on other machines will
1835not be able to communicate with the e-business client).  To determine
1836if the machine is running Net Firewall, open the Network Connection the
1837machine is using, and click on "Properties".  If "Net Firewall" is
1838listed as a component, and it is checked, then the e-business client will
1839experience this problem.  If you uncheck "Net Firewall" and click
1840on OK, other machines will be able to ping the e-business client, and STAFProc
1841on other machines will be able to communicate with the e-business client.
1842</p><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3><p>
1843DO NOT UNINSTALL NET FIREWALL!  The AT&amp;T Net Client
1844will not run without Net Firewall, and if Net Firewall is uninstalled,
1845you must completely reinstall the AT&amp;T Net Client.
1846</p></div><div class="procedure"><p class="title"><b>Procedure&nbsp;4.&nbsp;Changing the DNS settings on Linux</b></p><ol type="1"><li>
1847Edit the /etc/sysconfig/network file and change the HOSTNAME line to include
1848the domain name (e.g. austin.ibm.com) as part of the hostname.  For example::
1849<pre class="programlisting">
1850HOSTNAME="client1.austin.ibm.com"
1851</pre></li><li>
1852and add a line specifying the domain name (e.g. austin.ibm.com):
1853<pre class="programlisting">
1854DOMAINNAME="austin.ibm.com"
1855</pre></li><li>
1856Reboot the machine
1857</li></ol></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
1858Certain versions of Linux set up a high level of security access for incoming
1859requests on specific ports (including STAF requests, which, by default,
1860come in through port 6550 for the ssl interface or 6500 for the tcp interface).
1861From a Linux machine, if you are able to successfully send a <span><b class="command">staf ping</b></span>
1862to another machine, but the other machine cannot do a <span><b class="command">staf ping</b></span> to
1863the Linux machine (and you have verified that the DNS information is set up correctly on both
1864machines), try the following (note that you may need to customize these
1865commands depending on the Linux distribution):
1866</p><div class="orderedlist"><ol type="1"><li>
1867On RedHat 8.0, edit the /etc/sysconfig/iptables file and add the following lines:
1868<pre class="programlisting">
1869-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 6500 --syn -j ACCEPT
1870-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 6550 --syn -j ACCEPT
1871</pre><p>
1872Be sure to add these <span><b class="command">ACCEPT</b></span> lines to accept traffic via
1873the tcp ports you've configured for STAF <span class="emphasis"><em>before</em></span> the
1874<span><b class="command">REJECT</b></span> or <span><b class="command">DROP</b></span> line in the
1875iptables file which rejects/drops all other traffic.
1876</p></li><li>
1877On RHEL4 and RHEL5, edit the /etc/sysconfig/iptables file and add the following lines:
1878<pre class="programlisting">
1879-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6500 -j ACCEPT
1880-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6550 -j ACCEPT
1881</pre><p>
1882Be sure to add these <span><b class="command">ACCEPT</b></span> lines to accept traffic via
1883the tcp ports you've configured for STAF <span class="emphasis"><em>before</em></span> the
1884<span><b class="command">REJECT</b></span> or <span><b class="command">DROP</b></span> line in the
1885iptables file which rejects/drops all other traffic.
1886</p></li><li>
1887Then execute:
1888<pre class="screen">
1889<span><b class="command">/etc/rc.d/init.d/iptables restart</b></span>
1890</pre></li></ol></div></div><div class="procedure"><p class="title"><b>Procedure&nbsp;5.&nbsp;Changing the DNS settings on HP-UX</b></p><ol type="1"><li>
1891Edit the /etc/rc.config.d/netconf file and change the HOSTNAME line to include
1892the domain name (e.g. austin.ibm.com) as part of the hostname.  For example:
1893<pre class="programlisting">
1894HOSTNAME="client1.austin.ibm.com"
1895</pre></li><li>
1896and add a line specifying the domain name (e.g. austin.ibm.com):
1897<pre class="programlisting">
1898DOMAINNAME="austin.ibm.com"
1899</pre></li><li>
1900Reboot the machine
1901</li></ol></div></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1132"></a><a name="d0e1133"></a><b>3.1.5.</b></td><td align="left" valign="top"><p>
1902Why aren't my entries in /etc/hosts being used for STAF communication (particularly on Linux SLES)?
1903</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1904On Linux, if you are using /etc/hosts to specify hostnames/IPs, and a regular
1905"ping" to the hostname works, but a STAF ping fails with RC 16, it is likely
1906that your /etc/hosts file is not being used.
1907</p><p>
1908Ensure that your /etc/host.conf file looks contains
1909</p><pre class="screen">
1910order hosts, bind
1911</pre><p>
1912Also verify that the /etc/nsswitch.conf file contains:
1913</p><pre class="screen">
1914hosts:          files dns
1915</pre><p>
1916If your /etc/host.conf file contains the following line:
1917</p><pre class="screen">
1918multi on
1919</pre><p>
1920Verify that you are using STAF V3.1.5 or later (which contains a fix for handling 'multi on').
1921If you are using an earlier version of STAF, you can workaround this problem
1922by commenting out the 'multi on' line, and then restarting STAFProc.
1923</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1151"></a><a name="d0e1152"></a><b>3.1.6.</b></td><td align="left" valign="top"><p>
1924Why can't I use the HELP service when STAF is not running?
1925</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1926<span><b class="command">staf local help error <i class="replaceable"><tt>error-number</tt></i></b></span>
1927doesn't work if STAF is not running on your workstation.  Users can access help
1928messages offline (when STAF isn't running) by viewing the STAF documentation.
1929STAF documentation is installed on the local system (if a typical install was
1930done).  The "STAF API Return Code Reference" contains a quick reference to the
1931STAF return codes and is available at staf/docs/STAFRC.htm or you can view it
1932on the STAF SourceForge website at
1933<a href="http://staf.sourceforge.net/current/STAFRC.htm" target="_top">
1934http://staf.sourceforge.net/current/STAFRC.htm</a>.
1935</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1167"></a><a name="d0e1168"></a><b>3.1.7.</b></td><td align="left" valign="top"><p>
1936Why are there are more STAF processes on Linux?
1937</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1938If you issue the following command
1939</p><pre class="screen">
1940<span><b class="command">ps -ef | grep -i staf</b></span>,
1941</pre><p>
1942you will see more STAFProc processes (typically 10 or more) on Linux than on
1943other platforms (which there's only one).
1944</p><p>
1945This is because the Linux base operating system doesn't really have threads.
1946Threads are simulated on Linux using processes, so each thread shows up as
1947a process.
1948</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1183"></a><a name="d0e1184"></a><b>3.1.8.</b></td><td align="left" valign="top"><p>
1949Why am I having problems (such as an RC 6) submitting a request to a Java service?
1950</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1951If you are having a problem accessing a Java service, such as getting
1952an RC 6 for any request you make to a Java service, the Java service's
1953JVM may have encountered an error or may have been killed. Check the Java
1954service's JVM log to see if any errors were logged. The JVM logs are stored
1955in the {STAF/DataDir}/lang/java/jvm/&lt;JVMName&gt; directory on the
1956system where the Java service is registered. The current JVM log is named
1957JVMLog.1.
1958</p><p>
1959If the JVM log contains an OutOfMemory error, any Java services using
1960this JVM will have to be removed and added (registered) in order to start
1961accepting requests. You may want to look at increasing the JVM's maximum
1962heap size as the Java service(s) using this JVM may require more memory
1963than can be allocated. Refer to the STAF User's Guide, section "4.4.3 JSTAF
1964service proxy library", for more information on how to do this.
1965</p><p>
1966Make sure you are using STAF V3.1.5 or later which contains a significant
1967memory leak fix for STAF Java support.
1968</p><p>
1969If the JVM was killed, there won't be errors regarding this in the JVM
1970log, but the following error is written to the STAFProc window when a request
1971is made to a Java service whose java executable has died:
1972</p><pre class="screen">
1973In JSTAF.STAFServiceAcceptRequest:
1974Caught STAFException
1975Name : STAFConnectionConnectException
1976Location : d:\dev\sf\src\staf\stafif\win32\STAFLocalConnection.cpp(162)
1977Text : OpenProcess2
1978Error code: 87
1979</pre><p>
1980</p><p>
1981If the JVM was killed, any Java services using this JVM will have to be
1982removed and added (registered) in order to start accepting requests.
1983</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1202"></a><a name="d0e1203"></a><b>3.1.9.</b></td><td align="left" valign="top"><p>
1984Why is STAFProc terminating on some Unix platforms (such as Solaris)
1985when the STAFProc terminal is exited?
1986</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
1987For example, if you have a script such as:
1988</p><pre class="programlisting">
1989PATH=/usr/local/staf/bin:/usr/local/java/bin:$PATH
1990export PATH
1991CLASSPATH=/usr/local/staf/lib:/usr/local/staf/lib/JSTAF.jar:$CLASSPATH
1992export CLASSPATH
1993STAFCONVDIR=/usr/local/staf/codepage
1994export STAFCONVDIR
1995LD_LIBRARY_PATH=/usr/local/staf/lib:$LD_LIBRARY_PATH
1996export LD_LIBRARY_PATH
1997/usr/local/staf/bin/STAFProc &amp;
1998</pre><p>
1999</p><p>
2000STAF will start fine if you log in and exec this script, but when you
2001log out, STAF terminates.
2002</p><p>
2003To resolve this you should change the last line in the script to:
2004</p><pre class="programlisting">
2005nohup /usr/local/staf/bin/STAFProc &gt;/tmp/STAFProc.out 2&gt;&amp;1 &amp;
2006</pre><p>
2007</p><p>
2008You should redirect STAFProc's stdout and stderr to a file,
2009as shown above, because STAFProc's output is very important when
2010investigating a STAF problem.
2011</p><pre class="screen">
2012<tt class="prompt">#</tt> <span><b class="command">man nohup</b></span>
2013
2014NAME
2015     nohup - run a command immune to hangups
2016
2017SYNOPSIS
2018     /usr/bin/nohup command [ argument ...]
2019     /usr/xpg4/bin/nohup command [ argument ...]
2020
2021DESCRIPTION
2022     The nohup utility invokes the named command with argu-
2023     ments supplied.  When the command is invoked, nohup arranges
2024     for the SIGHUP signal to be ignored by the process.
2025
2026     The nohup utility can be used when it is known that command
2027     will take a long time to run and the user wants to logout of
2028     the terminal; when a shell exits, the system sends its chil-
2029     dren SIGHUP signals, which by default cause them to be
2030     killed.  All stopped, running, and background jobs will
2031     ignore SIGHUP and continue running, f their invocation is
2032     preceded by the nohup command or if the process programmati-
2033     cally has chosen to ignore SIGHUP.
2034</pre></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1229"></a><a name="d0e1230"></a><b>3.1.10.</b></td><td align="left" valign="top"><p>
2035Why don't I see any Java service output in the STAFProc console anymore?
2036</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2037The console output was redirected because in STAF 2.4.4 we changed the
2038way JVMs for STAF Java services (such as STAX) output all of their
2039stdout/stderr data (including the output of &lt;script&gt;print...&lt;/script&gt;
2040since that is being written to the JVM's stdout). All of the output that
2041was formerly in the console output should now be in the JVMLog file.
2042The file is located at:
2043</p><pre class="screen">
2044{STAF/DataDir}/lang/java/jvm/<i class="replaceable"><tt>JVM Name</tt></i>/JVMLog.<i class="replaceable"><tt>x</tt></i>
2045</pre><p>
2046where <i class="replaceable"><tt>x</tt></i> is a number and
2047<i class="replaceable"><tt>JVM Name</tt></i> is STAFJVM1 by default unless you used the
2048JVMName OPTION when configuring the Java service and set it to another name.
2049</p><p>
2050If you look at your {STAF/DataDir}/lang/java/jvm/STAFJVM1/JVMLog.1 file, you should
2051see something like:
2052</p><pre class="screen">
2053 ******************************************************************************
2054 *** 20030418-14:40:33 - Start of Log for JVMName: STAFJVM1
2055 *** JVM Executable: java
2056 *** JVM Options : none
2057 ******************************************************************************
2058</pre><p>
2059</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1257"></a><a name="d0e1258"></a><b>3.1.11.</b></td><td align="left" valign="top"><p>
2060When using Sun Java 1.4.2, why are the -Xmx settings for my Java STAF service
2061not being used?
2062</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2063This appears to be a bug in Sun Java 1.4.2 where it is not using the -Xmx heap
2064settings.  This means that if you are running Java STAF services with Sun 1.4.2,
2065 and specifying the OPTION J2=-Xmx option, the option will not be used and your
2066 service JVM will run out of memory at a much lower heap size (the actual limit
2067 seems to vary by OS).
2068</p><p>
2069IBM Java 1.4.2 works correctly
2070(http://www-106.ibm.com/developerworks/java/jdk/index.html)
2071</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1267"></a><a name="d0e1268"></a><b>3.1.12.</b></td><td align="left" valign="top"><p>
2072Explain RC 21 when running <span><b class="command">staf local ping ping</b></span> on
2073Unix platforms.
2074</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2075When executing STAFEnv.sh during system startup on Unix platforms, it is
2076possible to inadvertently pass "start" as the parameter to STAFEnv.sh (and
2077so STAFProc is using that as the instance name when it starts). In this
2078scenario, if you run <span><b class="command">staf &lt;unix-machine&gt; var list</b></span>
2079from another machine and examine the value
2080of STAF/Config/InstanceName, the value will be set to "start". So, even
2081though "echo $STAF_INSTANCE_NAME" is set to "STAF" as expected when you run
2082"staf local ping ping", the value that STAFProc is using does not match,
2083and so you get an RC 21.
2084</p><p>
2085If this is the case, you can resolve the problem by adding a "shift"
2086command to the start section of the STAF startup script just before
2087STAFEnv.sh is called.
2088That way, the parameters are decremented from 1 to 0. So you would have
2089something like:
2090</p><pre class="screen">
2091'start')
2092        if [ -f /etc/rc.config.d/staf ]; then
2093                . /etc/rc.config.d/staf
2094        fi
2095        if [ $STAF -eq 1 ]; then
2096                shift
2097                . /usr/local/staf/STAFEnv.sh
2098                /bin/nohup STAFProc 2&gt;error &amp;
2099        fi
2100        ;;
2101</pre><p>
2102</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="Error accepting on server socket, socket RC: 24"></a><a name="d0e1287"></a><b>3.1.13.</b></td><td align="left" valign="top"><p>Explain "Error accepting on server socket,socket RC: 24"</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2103This error can occur when your system has run out of file descriptors because
2104too many files have been opened and you've exceeded the maximum number
2105of open files allowed by your system.  Anytime a file is opened, a file descriptor
2106must be used to allow the program to access the data.
2107When the STAF connection provider calls accept() to accept a connection on
2108a socket and it's failing to open the socket and setting errno to 24 (this is the
2109error code on Unix systems).  In /usr/include/asm/errno.h on Linux systems,
2110errno 24 is defined as:
2111</p><pre class="programlisting">
2112#define EMFILE          24      /* Too many open files */
2113</pre><pre class="programlisting">
2114EMFILE The per-process limit of open file descriptors has been reached.
2115</pre><p>
2116To see what files are open on Unix machines, use the <span><b class="command">lsof</b></span>
2117command.  It lists the names of the open files and the pids of the processes
2118that opened them.  You can list the open files for a process by getting it's pid and then
2119run <span><b class="command">lsof -p &lt;pid&gt;</b></span>command&gt;.
2120</p><p>
2121If you you are using the STAX service on this machine, it's possible that
2122a STAX job could be responsible for opening files and not closing them.
2123Refer to <a href="#RC 21 submitting a STAX EXECUTE request">
2124Explain "RC 21 submitting a STAX EXECUTE request"</a> for more information
2125on this.
2126</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="Error using STAF Java libraries on Linux: libJSTAF.so: undefined symbol: _ZNSt8ios_base4InitD1Ev"></a><a name="d0e1313"></a><b>3.1.14.</b></td><td align="left" valign="top"><p>Explain error using STAF Java libraries on Linux: libJSTAF.so: undefined symbol: _ZNSt8ios_base4InitD1Ev"</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2127This error can occur when using the STAF Java libraries on Linux systems
2128using IBM Java 5.0 SR 11 (or later) or IBM Java 6.0 SR7 (or later).
2129</p><p>
2130This problem is fixed in STAF V3.4.1 and later.
2131</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="Slow performance sending a STAF PING request to a remote machine"></a><a name="d0e1323"></a><b>3.1.15.</b></td><td align="left" valign="top"><p>Why is the performance slow when sending a STAF PING request to a remote machine?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2132If submitting a STAF PING request to the PING service on a remote machine is slow
2133(e.g. &gt; 5 seconds), and it is not because the network is slow, a hostname
2134resolution issue may be causing the performance issue.  To debug this, enable
2135the STAF warning and error tracepoints on both machines and redirect the STAFProc
2136trace output to a file by running the following commands on each machine
2137(specifying a file name of your choice):
2138</p><pre class="screen">
2139STAF local TRACE ENABLE TRACEPOINTS "warning error"
2140STAF local TRACE SET DESTINATION TO FILE "/tmp/STAFProc.trc"
2141</pre><p>
2142</p><p>
2143Then, submit the STAF PING request to the PING service on the remote machine
2144again and check if there are any errors or warnings logged in the STAF trace files
2145on each machine.
2146</p><p>
2147If you see a trace warning message like the following:
2148</p><pre class="programlisting">
2149Error getting hostname (for IP address <i class="replaceable"><tt>99.99.999.99</tt></i>, STAFSocketGetNameByInAddr(), RC: 0,
2150Info: Error getting hostent structure: gethostbyaddr_r() host_error=2 after retrying 20 times
2151</pre><p>
2152there is a problem resolving the host name.  You may be able to resolve
2153the issue by adding a hostname entry to the hosts network hostname file
2154(e.g. /etc/hosts) which keeps track of the mapping between host names and
2155IP addresses.</p><p>
2156Or, if you see a trace warning message like the following:
2157</p><pre class="programlisting">
2158STAFConnectionManager::makeConnection - Attempt #1 of 2 (Delay <i class="replaceable"><tt>91</tt></i> milliseconds), RC: 16, Result: &lt;Error Message&gt;
2159</pre><p>
2160you may want to increase the CONNECTTIMEOUT specified for the ssl and tcp
2161interfaces in the STAF.cfg file on the machine submitting the STAF service request.
2162The default connect timeout value is 5 seconds (5000 milliseconds).  To increase
2163it the connect timeout to 10 seconds, edit the STAF.cfg file and add
2164<span><b class="command">option CONNECTTIMEOUT 10000</b></span> to the ssl and tcp interfaces.
2165For example:
2166</p><pre class="programlisting">
2167# Enable TCP/IP connections
2168interface ssl library STAFTCP option Secure=Yes option Port=6550 option CONNECTTIMEOUT=10000
2169interface tcp library STAFTCP option Secure=No  option Port=6500 option CONNECTTIMEOUT=10000
2170</pre><p>
2171Note:  You must shutdown and restart STAFProc for any changes in the STAF.cfg file
2172to take effect.
2173</p></td></tr><tr class="question"><td align="left" valign="top"><a name="Why does a request to the LOG, MONITOR, RESPOOL, or ZIP service fail with RC 2 (Unknown service)"></a><a name="d0e1357"></a><b>3.1.16.</b></td><td align="left" valign="top"><p>Why does a request to the LOG, MONITOR, RESPOOL, or ZIP service fail with RC 2 (Unknown service)?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2174If you get RC 2 (Unknown service) submitting a STAF request to the LOG, MONITOR,
2175RESPOOL, or ZIP service (which are all external, not internal, STAF services),
2176it may be because you don't have the STAF default service loader service
2177reqistered in the STAF configuration file.  The default service loader service
2178is implemented by library STAFDSLS and it dynamically loads the Log, Zip,
2179Monitor, and ResPool C++ services if they haven't already been registered.
2180This service loader is configured automatically in the default STAF.cfg file as
2181follows:
2182</p><pre class="screen">
2183# Add default service loader
2184serviceloader library STAFDSLS
2185</pre><p>
2186</p><p>
2187Note that if you list all the STAF services via a "LIST SERVICES" request
2188submitted to the SERVICE service, you won't see the LOG, MONITOR, RESPOOL,
2189or ZIP services registered (if not explicitly registered) until a request
2190has been submitted to these services because then the STAFDSLS service
2191will dynamically load the service if it isn't already registered.
2192</p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e1368"></a><h4 class="title"><a name="d0e1368"></a>3.2. STAF Install Questions</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>3.2.1. <a href="#d0e1371">
2193If the InstallAnywhere installer fails, how do I get debug information?
2194</a></dt><dt>3.2.2. <a href="#d0e1381">What if AIX STAF environment variables (PATH, LIBPATH, etc.) are not set when opening a terminal?</a></dt><dt>3.2.3. <a href="#d0e1393">
2195When running STAFInst on Solaris, why does it fail with "test: unknown
2196operator -ef"?
2197</a></dt><dt>3.2.4. <a href="#d0e1410">
2198Explain message "JAR Archive failed security check corrupt JAR file" when
2199trying to download a STAF jar file
2200</a></dt><dt>3.2.5. <a href="#d0e1418">
2201Why does the STAF InstallAnywhere install fail on RHEL5?
2202</a></dt><dt>3.2.6. <a href="#d0e1431">
2203What entries do I need for STAF in my /etc/profile file if I am using the
2204STAF tar.gz installation?
2205</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1371"></a><a name="d0e1372"></a><b>3.2.1.</b></td><td align="left" valign="top"><p>
2206If the InstallAnywhere installer fails, how do I get debug information?
2207</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2208The STAF IA installers will create a log file called STAFInstall.log in the
2209root install directory.
2210</p><p>
2211The install log will contain a "Summary" section with status information for
2212the install.  If there were any errors during the install, the "Install Log
2213Detail" section will contain information about the errors.
2214</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1381"></a><a name="d0e1382"></a><b>3.2.2.</b></td><td align="left" valign="top"><p>What if AIX STAF environment variables (PATH, LIBPATH, etc.) are not set when opening a terminal?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2215Edit the file ~/.Xdefaults (create it in your home directory if it does
2216not exist) and add the following line:
2217</p><pre class="programlisting">
2218*loginShell:true
2219</pre><p>
2220Save the changes and logout/login.  Any terminals that you open will have
2221/etc/profile executed automatically (so that STAF's InstallAnywhere environment
2222variable updates will be read).
2223</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1393"></a><a name="d0e1394"></a><b>3.2.3.</b></td><td align="left" valign="top"><p>
2224When running STAFInst on Solaris, why does it fail with "test: unknown
2225operator -ef"?
2226</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2227If you receive this error message when running the command
2228<span><b class="command">./STAFInst"</b></span> on Solaris, this indicates that the current
2229Solaris shell does not support certain "test" commands.  The solution for
2230this problem is to enter <span><b class="command">bash</b></span> at your shell prompt prior
2231to entering <span><b class="command">./STAFInst</b></span>.
2232</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1410"></a><a name="d0e1411"></a><b>3.2.4.</b></td><td align="left" valign="top"><p>
2233Explain message "JAR Archive failed security check corrupt JAR file" when
2234trying to download a STAF jar file
2235</p><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2236Certain browsers may report this problem when downloading jar files.
2237To resolve the problem, "shift-click" on the link to download the jar file.
2238</p><p></p></td></tr></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1418"></a><a name="d0e1419"></a><b>3.2.5.</b></td><td align="left" valign="top"><p>
2239Why does the STAF InstallAnywhere install fail on RHEL5?
2240</p><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2241When installing using IA on RHEL5, when attempting to launch the STAF
2242installer, the following error may be seen: "The installer is unable to
2243run in graphical mode.".  On RHEL5, the libraries required to run a
2244Swing based Java application (such as our STAF installers) may not be
2245installed by default.  See this
2246<a href="http://knowledge.macrovision.com/selfservice/microsites/search.do?cmd=displayKC&amp;docType=kc&amp;externalId=Q113124&amp;sliceId=1&amp;docTypeID=DT_PROBLEM_1_1&amp;dialogID=3183783&amp;stateId=0%200%203181344" target="_top">
2247Macrovision (InstallShield, InstallAnywhere) article</a> for
2248more information.
2249</p><p>
2250To resolve the problem, install the required X libraries on the RHEL5
2251system.  For example, download libXp-1.0.0-8.1.el5.i386.rpm and install
2252it via RPM.
2253</p><p></p></td></tr></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1431"></a><a name="d0e1432"></a><b>3.2.6.</b></td><td align="left" valign="top"><p>
2254What entries do I need for STAF in my /etc/profile file if I am using the
2255STAF tar.gz installation?
2256</p><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2257Below is an example of the lines needed in /etc/profile when using the
2258STAF tar.gz installation.  You can cut and paste this directly into your
2259/etc/profile if you have installed STAF to the default location (/usr/local/staf):
2260</p><pre class="screen">
2261if [ -z "`echo $PATH`" ]
2262then
2263PATH=/usr/local/staf/bin
2264else
2265PATH=`echo $PATH`:/usr/local/staf/bin
2266fi
2267export PATH
2268
2269if [ -z "`echo $LD_LIBRARY_PATH`" ]
2270then
2271LD_LIBRARY_PATH=/usr/local/staf/lib
2272else
2273LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH`:/usr/local/staf/lib
2274fi
2275export LD_LIBRARY_PATH
2276
2277if [ -z "`echo $CLASSPATH`" ]
2278then
2279CLASSPATH=/usr/local/staf/lib/JSTAF.jar:/usr/local/staf/samples/demo/STAFDemo.jar
2280else
2281CLASSPATH=/usr/local/staf/lib/JSTAF.jar:/usr/local/staf/samples/demo/STAFDemo.jar:`echo $CLASSPATH`
2282fi
2283export CLASSPATH
2284
2285STAFCONVDIR=/usr/local/staf/codepage
2286export STAFCONVDIR
2287</pre><p>
2288Note that this example is for Linux.  On other Unix platforms, use the
2289appropriate library environment variable (instead of LD_LIBRARY_PATH).
2290</p><p></p></td></tr></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e1442"></a><h4 class="title"><a name="d0e1442"></a>3.3. STAF Startup Questions</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>3.3.1. <a href="#d0e1445">Explain startup error: Error constructing service, JSTAF</a></dt><dt>3.3.2. <a href="#d0e1479">Explain startup error: Error binding server socket, bind() RC=98 (or 67)</a></dt><dt>3.3.3. <a href="#d0e1550">Explain startup error: Error binding server socket, bind() RC=10048</a></dt><dt>3.3.4. <a href="#d0e1573">
2291Explain startup error: 38:Illegal access to class: com.ibm.staf.service....
2292</a></dt><dt>3.3.5. <a href="#d0e1583">
2293Why does STAF's user registration fail each time STAFProc is started?
2294</a></dt><dt>3.3.6. <a href="#d0e1591">
2295Explain startup error:  Error initializing service, RESPOOL. RC: 4008
2296</a></dt><dt>3.3.7. <a href="#d0e1601">What should I do if STAF fails to init with Windows Terminal Server?</a></dt><dt>3.3.8. <a href="#d0e1611">
2297On SLES8, why do I get an error starting STAF: STAFProc:
2298/usr/lib/libstdc++.so.5: version `GLIBCPP_3.2.2' not found (required by
2299STAFProc)
2300</a></dt><dt>3.3.9. <a href="#d0e1619">
2301Explain startup error on z/OS: Error binding server socket, bind() RC=1115
2302</a></dt><dt>3.3.10. <a href="#d0e1629">Explain startup error: RC: 27, Error initializing service, JSTAF when using a
2303GNU compiler for Java provided with Linux</a></dt><dt>3.3.11. <a href="#d0e1643">Explain HPUX error "sh: SHLIB_PATH: Parameter not set." when running
2304/usr/local/staf/STAFEnv.sh, or when running it via sourcing .profile)</a></dt><dt>3.3.12. <a href="#d0e1651">When logged into the desktop on RHEL4-U4, if I run "STAFProc" or
2305"STAF", I get "error while loading shared libraries: libSTAF.so".</a></dt><dt>3.3.13. <a href="#d0e1669">Explain AIX error "Symbol XX__Q2_3std8ios_base is not exported from
2306dependent module /usr/lib/libC.a"</a></dt><dt>3.3.14. <a href="#d0e1694">
2307Explain HPUX IA64 error /usr/lib/hpux32/dld.so: Unsatisfied code symbol
2308'__cxa_get_exception_ptr' in load module './STAFProc'.
2309</a></dt><dt>3.3.15. <a href="#d0e1716">
2310On Windows x86_64), explain error OS RC 14001: This application has failed to start
2311because the application configuration is incorrect..
2312</a></dt><dt>3.3.16. <a href="#d0e1735">
2313Explain Linux error "STAFProc: relocation error: undefined
2314symbol: _ZNSs4_Rep20_S_empty_rep_storageE" when starting STAFProc.
2315</a></dt><dt>3.3.17. <a href="#d0e1768">
2316Explain Solaris Sparc 64-bit error when starting STAFProc:
2317"/usr/sfw/lib/libstdc++.so.6: wrong ELF class: ELFCLASS32".
2318</a></dt><dt>3.3.18. <a href="#d0e1785">
2319Explain startup error: Error creating interface.  Could not determine
2320logical/physical identifier.
2321</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1445"></a><a name="d0e1446"></a><b>3.3.1.</b></td><td align="left" valign="top"><p>Explain startup error: Error constructing service, JSTAF</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2322You can get an error like the following when STAF attempts to
2323register a Java service (such as Event, STAX, EventManager, Cron,
2324Email, etc) that is configured in the STAF.cfg file:
2325</p><pre class="screen">
2326Error code: 27
2327Reason    : Error constructing service, JSTAF, Result: Unable to connect to JVM
2328</pre><p>
2329When you get this error, look at the contents of the JVM log for this
2330Java STAF service (located in {STAF/DataDir}/lang/java/jvm/&lt;JVMName&gt;/JVMLog.1)
2331to get more information about the cause of the error.  For example,
2332the following is an example of an error logged in the
2333C:\STAF\data\lang\java\jvm\STAFJVM1\JVMLog.1 file when STAFProc
2334cannot find the "java" binary executable on Windows:
2335</p><pre class="programlisting">
2336******************************************************************************
2337*** 20140102-12:40:48 - Start of Log for JVMName: STAFJVM1
2338*** JVM Executable: java
2339*** JVM Options   : none
2340*** JVM Version   : '"java"' is not recognized as an internal or external command,
2341operable program or batch file.
2342</pre><p>
2343This error could occur if Java has not been installed on the system, or if
2344Java has been installed but the "java" binary executable is not in the PATH
2345environment variable in the environment in which you are running STAFProc
2346(or if you specified the JVM option when registering a Java STAF service
2347and specified an incorrect path to the location of the "java" binary
2348executable).  To fix this problem, make sure that Java is installed on this
2349system and then do <span><b class="command">one</b></span> of the following:</p><div class="orderedlist"><ol type="1"><li><p>Make sure the "java" binary executable is available in the
2350PATH environment variable by verifying that running
2351<span><b class="command">java -version</b></span> from a shell prompt works and returns the
2352version of Java found in the PATH,</p><p><span><b class="command">- OR -</b></span></p></li><li><p>Use the JVM option to specify the location of the java
2353executable when registering the Java STAF service in the STAF.cfg file.
2354For example, if the fully qualified location of the java executable is
2355"C:\jdk7\jre\bin\java.exe", use the JVM option as follows to specify this
2356when registering a Java service such as STAX:</p><pre class="screen">
2357SERVICE STAX LIBRARY JSTAF EXECUTE C:/STAF/services/stax/STAX.jar \
2358        OPTION JVMName=STAX <span><b class="command">OPTION JVM="C:/jdk7/jre/bin/java"</b></span>
2359</pre></li></ol></div></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1479"></a><a name="d0e1480"></a><b>3.3.2.</b></td><td align="left" valign="top"><p>Explain startup error: Error binding server socket, bind() RC=98 (or 67)</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2360This error can occur on Unix if STAFProc has not been shutdown correctly.
2361The error will be displayed when you attempt to restart STAFProc.
2362You should always shutdown STAF by submitting a SHUTDOWN request
2363to the STAF SHUTDOWN service.  For example:
2364</p><pre class="programlisting">
2365STAF local SHUTDOWN SHUTDOWN
2366</pre><p>
2367If you don't submit a SHUTDOWN request and instead kill the STAFProc process,
2368then STAFProc is not given the opportunity to kill other processes that
2369it started and to perform clean-up activities such as deleting it's temporary files.
2370</p><p>
2371For example, say you started STAFProc when logged in as the root user, and
2372then you killed STAFProc instead of submitting a SHUTDOWN request.
2373Then, you logged in as a non-root user and attempted to start STAFProc.
2374STAFProc may fail to start with a "Error binding server socket" message because the
2375non-root user does not have permission to delete the temporary STAF files that were
2376previously created by the root user (and were not deleted since STAFProc was not
2377shutdown correctly).
2378</p><p>
2379To resolve the problem:
2380</p><div class="orderedlist"><ol type="1"><li><p>
2381Go to the <span><b class="command">/tmp</b></span> directory, and delete the temporary
2382files that STAF created for the instance of STAFProc that you're trying to start.
2383You'll need to be logged on as a user that has permission to remove these files.
2384The temporary STAF files are named:
2385</p><div class="itemizedlist"><ul type="disc"><li><span><b class="command">XXXX.tmp</b></span></li><li><span><b class="command">DataDir_*XXXX.tmp</b></span></li><li><span><b class="command">STAFIPC_XXXX</b></span></li><li>All files beginning with <span><b class="command">STAFIPC_XXXXJSTAF</b></span>.  Note that
2386there could be one of these files for each STAF JVM that was created when registering STAF
2387Java services.</li></ul></div><p>
2388Note that you need to replace <span><b class="command">XXXX</b></span> with the STAF Instance Name.
2389The default STAF Instance Name is <span><b class="command">STAF</b></span> if you didn't override it
2390by setting the STAF_INSTANCE_NAME environment variable.
2391</p><p>
2392So, if you are trying to start STAFProc using the default STAF instance name <span><b class="command">STAF</b></span>,
2393then to delete these temporary STAF files, you could run the following commands when logged
2394on as a user that has permission to remove these files:
2395</p><pre class="programlisting">
2396   rm /tmp/STAF.tmp
2397   rm /tmp/DataDir_*STAF.tmp
2398   rm /tmp/STAFIPC_STAF
2399   rm /tmp/STAFIPC_STAFJSTAF*
2400</pre></li><li><p>
2401Also, type <span><b class="command">ps</b></span> or <span><b class="command">ps -ea</b></span> and determine if there
2402are any processes that STAF started which are still running or any java executables that
2403STAF started for it's Java services.  If there are any, you'll need to stop these processes in order
2404to restart STAFProc.  You can do this by typing <span><b class="command">kill xxx</b></span>
2405where xxx is the PID for the process.
2406</p></li><li><p>Restart STAFProc</p></li></ol></div><p>
2407</p><p>As a last resort if the above steps did not resolve the problem, reboot the machine.</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1550"></a><a name="d0e1551"></a><b>3.3.3.</b></td><td align="left" valign="top"><p>Explain startup error: Error binding server socket, bind() RC=10048</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2408This indicates that the socket address is already in use.  This error occurs
2409if STAF attempts to bind a socket to an IP address/port that has already been
2410used for an existing socket, or a socket that wasn't closed properly, or one
2411that is still in the process of closing.
2412</p><p>
2413You can also try typing <span><b class="command">ps</b></span> or <span><b class="command">ps -ea</b></span>
2414and determine if there are any processes that STAF started which are still running or any
2415java executables that STAF started for it's Java services.  If there are any, you'll need to
2416stop these processes in order to restart STAFProc.  You can do this by typing
2417<span><b class="command">kill xxx</b></span> where xxx is the PID for the process.
2418</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
2419Some Solaris systems require a system reboot to fix this condition.
2420</p></div><p>
2421</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1573"></a><a name="d0e1574"></a><b>3.3.4.</b></td><td align="left" valign="top"><p>
2422Explain startup error: 38:Illegal access to class: com.ibm.staf.service....
2423</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2424This error occurs if you attempt to register a Java service that has not been
2425declared public in its class definition.  Every STAF Java service's class
2426definition should look like:
2427</p><pre class="programlisting">
2428public class CronService implements STAFServiceInterfaceLevel3
2429</pre><p>
2430</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1583"></a><a name="d0e1584"></a><b>3.3.5.</b></td><td align="left" valign="top"><p>
2431Why does STAF's user registration fail each time STAFProc is started?
2432</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2433During the STAF installation, if you selected to register STAF, everytime
2434STAF starts it will attempt to register the user information with a machine
2435that is internal to IBM.  Once this registration is successful, STAF
2436will no longer try to register.  However, the registration will fail
2437for all non-IBM users, and will attempt to register (and fail) each time
2438STAF is started.  You can either choose to let it fail forever, or
2439delete the STAFReg.inf file (in the root STAF directory) and STAF will
2440stop trying to register.
2441</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1591"></a><a name="d0e1592"></a><b>3.3.6.</b></td><td align="left" valign="top"><p>
2442Explain startup error:  Error initializing service, RESPOOL. RC: 4008
2443</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2444The ResPool RC 4008 means "The directory specified by the DIRECTORY
2445parameter when registering the service or the default directory could not
2446be created."
2447</p><p>
2448It is likely that STAF was installed as another userid, and you are
2449now trying to use the ResPool as a different userid that doesn't have write
2450access to the STAF directory.
2451</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1601"></a><a name="d0e1602"></a><b>3.3.7.</b></td><td align="left" valign="top"><p>What should I do if STAF fails to init with Windows Terminal Server?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2452When using Windows 2000 Terminal Server and Windows XP remote desktop
2453feature with multiple users on a machine, only the user starting the STAF
2454process (STAFproc) can execute STAF commands from the command line. Others
2455users on the machine receive 'Error registering with STAF, RC: 21' when
2456issuing STAF commands.
2457</p><p>
2458To resolve this, install STAF as a Windows Service.  See the STAF Installation
2459Guide for more information.
2460</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1611"></a><a name="d0e1612"></a><b>3.3.8.</b></td><td align="left" valign="top"><p>
2461On SLES8, why do I get an error starting STAF: STAFProc:
2462/usr/lib/libstdc++.so.5: version `GLIBCPP_3.2.2' not found (required by
2463STAFProc)
2464</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2465This indicates that you do not have the latest libraries on the SLES8 system.
2466You need to install Service Pack 3 (SP3) to upgrade the system libraries.
2467</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1619"></a><a name="d0e1620"></a><b>3.3.9.</b></td><td align="left" valign="top"><p>
2468Explain startup error on z/OS: Error binding server socket, bind() RC=1115
2469</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2470This indicates that the socket address is already in use. This error occurs if
2471STAF attempts to bind a socket to an IP address/port that has already been used
2472for an existing socket, or a socket that wasn't closed properly, or one that is
2473still in the process of closing.
2474</p><p>
2475You should wait approximately 2-3 minutes for TCP/IP to complete the socket
2476close and retry starting STAF. You can also try typing ps or ps -ea and
2477determine if there are any processes that STAF started which are still running.
2478If there are any, type kill -9 xxx where xxx is the PID for the process.
2479</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1629"></a><a name="d0e1630"></a><b>3.3.10.</b></td><td align="left" valign="top"><p>Explain startup error: RC: 27, Error initializing service, JSTAF when using a
2480GNU compiler for Java provided with Linux</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2481This error can occur when starting STAFProc if Java STAF services (such
2482as STAX, Event, EventManager, Cron, Email, etc.) are configured in the
2483STAF.cfg file and the version of Java installed on the Linux machine
2484is the GNU compiler for Java.  For example, the following version
2485of Java cannot be used when registering STAF Java services:
2486</p><pre class="programlisting">
2487# java -version
2488java version "1.4.2"
2489gij (GNU libgcj) version 4.1.1 20060525 (Red Hat 4.1.1-1)
2490
2491Copyright (C) 2006 Free Software Foundation, Inc.
2492This is free software; see the source for copying
2493conditions. There is NO
2494warranty; not even for MERCHANTABILITY or FITNESS FOR A
2495PARTICULAR PURPOSE.
2496</pre><p>
2497When this version of Java is used to register a STAF Java service, you may
2498get an error like the following:
2499</p><pre class="programlisting">
2500Error initializing service, STAX, RC: 27, Result: Error
2501initializing service, JSTAF, Result: Error:
2502/usr/local/staf/data/STAF/lang/java/shared_jython/2.1-staf-v2/Lib/rfc822.py
2503(No such file or directory)
2504</pre><p>
2505Instead, use IBM or Oracle Java when registering a STAF Java service..
2506</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1643"></a><a name="d0e1644"></a><b>3.3.11.</b></td><td align="left" valign="top"><p>Explain HPUX error "sh: SHLIB_PATH: Parameter not set." when running
2507/usr/local/staf/STAFEnv.sh, or when running it via sourcing .profile)</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2508This is most likely because the .profile has a "set -u" statement in it.  This
2509statement turns on the safety restriction against working with undefined
2510variables.  On your system, if SHLIB_PATH was not defined, you would get this
2511error when running STAFEnv.sh or when running it via sourcing .profile.  If you
2512comment out the "set -u", the error should go away.
2513</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1651"></a><a name="d0e1652"></a><b>3.3.12.</b></td><td align="left" valign="top"><p>When logged into the desktop on RHEL4-U4, if I run "STAFProc" or
2514"STAF", I get "error while loading shared libraries: libSTAF.so".</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2515This error "error while loading shared libraries: libSTAF.so: cannot open shared
2516object file: No such file or directory" means that the STAF libraries
2517(including libSTAF.so) could not be
2518found.  These libraries are usually located in /usr/local/staf/lib, and the
2519environment variable LD_LIBRARY_PATH should include this directory so that
2520the libraries are found.  Normally you would either use the STAF InstallAnywhere
2521installer to install STAF, which will automatically update /etc/profile with
2522the required environment variables (including LD_LIBRARY_PATH) or you would
2523manually edit /etc/profile and set the environment variables.
2524</p><p>
2525However, as of RHEL4-U4, when logging into the desktop, any references to
2526LD_LIBRARY_PATH in /etc/profile will be ignored.
2527This means that after logging into the RedHat deskop, all of the required STAF
2528environment variables (PATH, CLASSPATH, etc) will be set except for
2529LD_LIBRARY_PATH, which will cause this error.  To correct this, after logging in
2530to the desktop, you can source the profile <span><b class="command">. ./etc/profile</b></span>
2531or run the STAFEnv script <span><b class="command">. ./usr/local/staf/STAFEnv.sh</b></span>.
2532</p><p>
2533Note that this problem will only occur when logging in directly to the RHEL4-U4
2534desktop.  If you telnet or ssh to a RHEL4-U4 machine, all the environment
2535variables in /etc/profile (including LD_LIBRARY_PATH) will be correctly set.
2536</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1669"></a><a name="d0e1670"></a><b>3.3.13.</b></td><td align="left" valign="top"><p>Explain AIX error "Symbol XX__Q2_3std8ios_base is not exported from
2537dependent module /usr/lib/libC.a"</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2538On the AIX 6.1 machine that we use to build STAF, we have the following
2539AIX XL C/C++ Runtime ("lslpp -l xlC.aix*.rte"):
2540</p><pre class="screen">
2541xlC.aix61.rte 11.1.0.0  COMMITTED  XL C/C++ Runtime for AIX 6.1
2542</pre><p>
2543If you try to run the STAF libraries on an AIX machine with a previous version
2544of the AIX XL C/C++ Runtime, such as:
2545</p><pre class="screen">
2546xlC.aix50.rte 5.0.2.2  COMMITTED  XL C/C++ Runtime for AIX 5.0
2547</pre><p>
2548You will get errors like:
2549</p><pre class="screen">
2550Could not load program ./STAFProc:
2551Symbol resolution failed for /usr/local/staf/lib/libSTAF.so because:
2552         Symbol in__Q2_3std8ios_base (number 126) is not exported from
2553dependent
2554           module /usr/lib/libC.a(ansi_32.o).
2555         Symbol out__Q2_3std8ios_base (number 127) is not exported from
2556dependent
2557           module /usr/lib/libC.a(ansi_32.o).
2558         Symbol adjustfield__Q2_3std8ios_base (number 129) is not exported
2559 from dependent
2560           module /usr/lib/libC.a(ansi_32.o).
2561         Symbol left__Q2_3std8ios_base (number 130) is not exported from
2562dependent
2563           module /usr/lib/libC.a(ansi_32.o).
2564         Symbol fixed__Q2_3std8ios_base (number 131) is not exported from
2565dependent
2566           module /usr/lib/libC.a(ansi_32.o).
2567         Symbol showpos__Q2_3std8ios_base (number 132) is not exported from
2568dependent
2569           module /usr/lib/libC.a(ansi_32.o).
2570         Symbol showpoint__Q2_3std8ios_base (number 133) is not exported
2571 from dependent
2572           module /usr/lib/libC.a(ansi_32.o).
2573         Symbol floatfield__Q2_3std8ios_base (number 134) is not exported
2574 from dependent
2575           module /usr/lib/libC.a(ansi_32.o).
2576         Symbol scientific__Q2_3std8ios_base (number 135) is not exported
2577 from dependent
2578           module /usr/lib/libC.a(ansi_32.o).
2579         Symbol internal__Q2_3std8ios_base (number 136) is not exported
2580 from dependent
2581           module /usr/lib/libC.a(ansi_32.o).
2582         Symbol uppercase__Q2_3std8ios_base (number 137) is not exported
2583 from dependent
2584           module /usr/lib/libC.a(ansi_32.o).
2585         Symbol showbase__Q2_3std8ios_base (number 138) is not exported
2586 from dependent
2587           module /usr/lib/libC.a(ansi_32.o).
2588         Symbol basefield__Q2_3std8ios_base (number 139) is not exported
2589 from dependent
2590           module /usr/lib/libC.a(ansi_32.o).
2591         Symbol oct__Q2_3std8ios_base (number 140) is not exported from
2592dependent
2593           module /usr/lib/libC.a(ansi_32.o).
2594         Symbol hex__Q2_3std8ios_base (number 141) is not exported from
2595dependent
2596           module /usr/lib/libC.a(ansi_32.o).
2597         Symbol boolalpha__Q2_3std8ios_base (number 142) is not exported
2598 from dependent
2599           module /usr/lib/libC.a(ansi_32.o).
2600         Symbol eofbit__Q2_3std8ios_base (number 143) is not exported from
2601dependent
2602           module /usr/lib/libC.a(ansi_32.o).
2603           Symbol failbit__Q2_3std8ios_base (number 144) is not exported from
2604dependent
2605           module /usr/lib/libC.a(ansi_32.o).
2606         Symbol skipws__Q2_3std8ios_base (number 145) is not exported from
2607dependent
2608           module /usr/lib/libC.a(ansi_32.o).
2609         Symbol dec__Q2_3std8ios_base (number 146) is not exported from
2610dependent
2611           module /usr/lib/libC.a(ansi_32.o).
2612         Symbol goodbit__Q2_3std8ios_base (number 147) is not exported from
2613dependent
2614           module /usr/lib/libC.a(ansi_32.o).
2615         Symbol badbit__Q2_3std8ios_base (number 148) is not exported from
2616dependent
2617           module /usr/lib/libC.a(ansi_32.o).
2618         Symbol unitbuf__Q2_3std8ios_base (number 149) is not exported from
2619dependent
2620           module /usr/lib/libC.a(ansi_32.o).
2621         Symbol space__Q2_3std10ctype_base (number 150) is not exported
2622 from dependent
2623           module /usr/lib/libC.a(ansi_32.o).
2624         Symbol ate__Q2_3std8ios_base (number 151) is not exported from
2625dependent
2626           module /usr/lib/libC.a(ansi_32.o).
2627         Symbol trunc__Q2_3std8ios_base (number 152) is not exported from
2628dependent
2629           module /usr/lib/libC.a(ansi_32.o).
2630         Symbol binary__Q2_3std8ios_base (number 153) is not exported from
2631dependent
2632           module /usr/lib/libC.a(ansi_32.o).
2633Examine .loader section symbols with the 'dump -Tv' command.
2634</pre><p>
2635To correct the problem, you need to upgrade the machine's xlC.aix61.rte
2636to at least 11.1.0.0.
2637</p><p>
2638<a href="http://groups.google.com/group/comp.unix.aix/browse_frm/thread/2f102ecd68bff6ce/70dfaef4e2fb6908?lnk=st&amp;q=Symbol+badbit__Q2_3std8ios_base&amp;rnum=2#70dfaef4e2fb6908" target="_top">
2639See this related discussion on Google.</a>
2640</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1694"></a><a name="d0e1695"></a><b>3.3.14.</b></td><td align="left" valign="top"><p>
2641Explain HPUX IA64 error /usr/lib/hpux32/dld.so: Unsatisfied code symbol
2642'__cxa_get_exception_ptr' in load module './STAFProc'.
2643</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2644This error message indicates that this version of STAF was compiled on a
2645newer OS version that is not compatible with the machine's OS version.
2646</p><p>
2647In STAF V3.2.2, the machine used to build STAF for HPUX IA64 was upgraded
2648to OS version 11.31, and so STAF V3.2.2 through V3.3.0 will only run on HPUX
2649IA64 11.31 or later, and if you attempt to run STAF V3.2.2 - V3.3.0 on a
2650machine with an OS version earlier than 11.31, such as HPUX IA64 11.23, you
2651will get this error.  In STAF V3.3.1, we changed the HPUX IA64 build machine
2652back to 11.23.
2653</p><p>
2654To resolve this problem you need to do one of the following:
2655</p><div class="itemizedlist"><ul type="disc"><li><p>
2656Use STAF V3.3.1 or later or V3.2.1 or earlier.
2657</p></li><li><p>
2658Upgrade the machine OS version to HPUX IA64 11.31 or later
2659</p></li><li><p>
2660Build a custom version of STAF on your HPUX IA64 11.23 machine (this will
2661require the HP aCC compiler to be installed)
2662</p></li></ul></div><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1716"></a><a name="d0e1717"></a><b>3.3.15.</b></td><td align="left" valign="top"><p>
2663On Windows x86_64), explain error OS RC 14001: This application has failed to start
2664because the application configuration is incorrect..
2665</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2666On Windows x86_64 (aka AMD64) using STAF V3.3.0 or later, if you get an error like the following
2667when starting STAFProc:</p><pre class="screen">
2668C:\STAF\bin&gt;STAFProc
2669Error on INTERFACE definition, interface tcp library STAFTCP option Secure=No option Port=6500
2670Error creating interface, RC: 10, Reason: STAFDynamicLibrary: STAFTCP:
2671Cannot open library file (aka module/DLL), OS RC 14001: This application has failed
2672to start because the application configuration is incorrect. Reinstalling the
2673application may fix this problem.
2674</pre><p>
2675this indicates that the Microsoft Visual C++ 2005 runtime libraries are not
2676installed on your machine.</p><p>
2677In STAF V3.3.0, the STAF TCP interface was updated to provide support for
2678secure connections using OpenSSL and this change requires that the
2679Microsoft Visual C++ 2005 runtime libraries be installed.  In STAF V3.3.1,
2680we updated the STAF install to install these libraries for you so you don't
2681have to.</p><p>
2682To resolve this problem, if you are using STAF V3.3.0, upgrading to STAF V3.3.1 or
2683later should resolve this problem for you.  Or, you can download file vcredist_x64.exe from
2684<a href="http://www.microsoft.com/downloads/details.aspx?familyid=90548130-4468-4bbc-9673-d6acabd5d13b&amp;displaylang=en" target="_top">
2685Microsoft Visual C++ 2005 Redistributable Package (x64)</a> and run it to install
2686the Microsoft Visual C++ 2005 runtime libraries which should resolve the problem.
2687</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1735"></a><a name="d0e1736"></a><b>3.3.16.</b></td><td align="left" valign="top"><p>
2688Explain Linux error "STAFProc: relocation error: undefined
2689symbol: _ZNSs4_Rep20_S_empty_rep_storageE" when starting STAFProc.
2690</p><p></p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2691When starting STAFProc on Linux, if you get an error like the following:
2692</p><pre class="screen">
2693STAFProc: relocation error: /usr/local/staf/lib/libSTAF.so: undefined symbol: _ZNSs4_Rep20_S_empty_rep_storageE
2694</pre><p>
2695</p><p>
2696The problem is resolved by:
2697</p><div class="orderedlist"><ol type="1"><li>Download the libstdc++.so.6 and libgcc_s.so.1 files used for our STAF
2698Linux IA-32 builds:
2699<p>
2700<a href="http://staf.sourceforge.net/oslibs/linux-ia32/libstdc++.so.6" target="_top">
2701http://staf.sourceforge.net/oslibs/linux-ia32/libstdc++.so.6</a>
2702</p><p>
2703<a href="http://staf.sourceforge.net/oslibs/linux-ia32/libgcc_s.so.1" target="_top">
2704http://staf.sourceforge.net/oslibs/linux-ia32/libgcc_s.so.1</a>
2705</p></li><li>Copy these to /usr/local/staf/lib and start STAFProc.
2706</li></ol></div><p>
2707See the
2708<a href="http://staf.sourceforge.net/current/STAFInstall.pdf" target="_top">
2709Section 10. Operating System Library Compatability (Linux)</a> section of
2710the STAF Installation Guide for more details.
2711</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1768"></a><a name="d0e1769"></a><b>3.3.17.</b></td><td align="left" valign="top"><p>
2712Explain Solaris Sparc 64-bit error when starting STAFProc:
2713"/usr/sfw/lib/libstdc++.so.6: wrong ELF class: ELFCLASS32".
2714</p><p></p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2715When starting STAFProc on Solaris Sparc 64-bit platforms, if you get an error
2716like the following:
2717</p><pre class="screen">
2718/usr/sfw/lib/libstdc++.so.6: wrong ELF class: ELFCLASS32
2719</pre><p>
2720</p><p>
2721The solution is to include "/usr/sfw/lib/sparcv9" in LD_LIBRARY_PATH:
2722</p><pre class="screen">
2723LD_LIBRARY_PATH=/usr/sfw/lib/sparcv9:$LD_LIBRARY_PATH
2724export LD_LIBRARY_PATH
2725STAFProc &amp;
2726</pre><p>
2727/usr/sfw/lib/sparcv9 contains the 64-bit Solaris Sparc libraries.
2728</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1785"></a><a name="d0e1786"></a><b>3.3.18.</b></td><td align="left" valign="top"><p>
2729Explain startup error: Error creating interface.  Could not determine
2730logical/physical identifier.
2731</p><p></p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2732When starting STAFProc, if you get an error like the following:
2733</p><pre class="screen">
2734Error on Interface definition line:
2735
2736interface ssl library STAFTCP option Secure=Yes option Port=6550
2737
2738Error code: 47
2739Reason    : Error creating interface.  STAFConnectionProviderConstruct: Could not determine logical/
2740physical identifier. Errorcode: 22  Reason: Error getting hostent structure: gethostbyaddr() RC=1
2741
2742Error in configuration file: /usr/local/staf/bin/STAF.cfg
2743</pre><p>
2744</p><p>
2745TCP/IP or DNS is probably not configured correctly which is why the
2746gethostbyaddr API called by STAFProc is not able to determine the host name for
2747the system.  To fix this issue, you should make sure that TCP/IP and DNS are
2748configured properly on this system.  On Linux, one way that you may be able to
2749resolve this issue is by editing the /etc/hosts file and adding a line to
2750specify the host name for this system's IP address.  For example, if your
2751system's IP address is 9.99.100.99 and its host name is linux1.company.com, you
2752could edit the /etc/hosts file and add the following line:
2753</p><pre class="screen">
27549.99.100.99             linux1.company.com  linux1
2755</pre><p>
2756</p><p></p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e1802"></a><h4 class="title"><a name="d0e1802"></a>3.4. PROCESS Service Questions</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>3.4.1. <a href="#d0e1805">Explain RC 10 when attempting to run a process</a></dt><dt>3.4.2. <a href="#d0e1825">Explain RC 25 when starting a process on a remote machine</a></dt><dt>3.4.3. <a href="#d0e1840">Explain why I'm having a problem interacting with process queues for
2757processes started via the command line</a></dt><dt>3.4.4. <a href="#d0e1902">Why are child processes not killed on Windows?</a></dt><dt>3.4.5. <a href="#d0e1916">
2758Why can't a STAF process log its output to an AFS directory?
2759</a></dt><dt>3.4.6. <a href="#d0e1924">
2760Why do I get a SIGABRT after a STAF process has completed on HP-UX?
2761</a></dt><dt>3.4.7. <a href="#d0e1940">
2762Explain error message: "STAFProcessManager::processMonitorThread: Parent
2763could not set child's pgid: 13"
2764</a></dt><dt>3.4.8. <a href="#d0e1948">
2765Explain Unix error message: STAFProcessManager::processMonitorThread: Could not
2766start process (execve): 8
2767</a></dt><dt>3.4.9. <a href="#d0e1956">
2768When running the ftp executable for Windows via a PROCESS START request, why aren't I getting the remote server responses in stdout?
2769</a></dt><dt>3.4.10. <a href="#d0e1982">Why do Expect scripts fail on Linux when STAFProc has been started
2770during system reboot?</a></dt><dt>3.4.11. <a href="#d0e2017">Why is different output returned by some commands such as "reg query"
2771when run using a win32 version of STAF on a Windows 64-bit system?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1805"></a><a name="d0e1806"></a><b>3.4.1.</b></td><td align="left" valign="top"><p>Explain RC 10 when attempting to run a process</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2772Return code 10 means "Base OS Error", and the additional info provided
2773in STAFResult is the actual error returned by the operating system. One
2774of the most common reasons for getting a Base OS Error is "File Not Found".
2775On Windows systems, OS error code 2 means "The system cannot find the file
2776specified". On Unix systems, OS error code 2 means "No such file or directory".
2777</p><p>
2778If you receive an OS error code 2, make sure the executable or script
2779file is in the PATH of the machine where it will be executed., or fully
2780qualify the COMMAND option on the process request (i.e. /opt/tests/mytest).
2781</p><p>
2782For Windows systems, you can find more information for OS error codes
2783by typing "net helpmsg &lt;error code&gt;".  So, to find more information for OS error
2784code 2 on a Windows 2000 system, type:
2785</p><pre class="screen">
2786<span><b class="command">net helpmsg 2</b></span>
2787</pre><p>
2788</p><p>
2789For Unix systems, you can find more information for OS error codes from
2790include files named errno.h found in directory /usr/include and its
2791subdirectories.
2792</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1825"></a><a name="d0e1826"></a><b>3.4.2.</b></td><td align="left" valign="top"><p>Explain RC 25 when starting a process on a remote machine</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2793This error indicates that you have submitted a request from a machine which is
2794not authorized to perform the request.  To start a process on a remote machine,
2795a TRUST level of 5 is required.
2796</p><p>
2797To resolve the problem:
2798</p><div class="itemizedlist"><ul type="disc"><li>
2799On the remote machine, add a TRUST statement to its STAF.cfg file, give
2800the requesting machine a trust level of 5.
2801</li><li>
2802Shutdown and restart STAF on the remote machine.
2803</li></ul></div><p>
2804</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1840"></a><a name="d0e1841"></a><b>3.4.3.</b></td><td align="left" valign="top"><p>Explain why I'm having a problem interacting with process queues for
2805processes started via the command line</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2806When you submit a request to STAF from the command line, a unique handle
2807is generated for that request.  After the request completes, that
2808handle is no longer active in STAFProc.  If you were to submit a subsequent
2809STAF request from the command line which referenced that handle or was
2810dependent upon the continued existence of that handle, your request would
2811fail.
2812</p><p>
2813Messages are sent to queues associated with specific handles.  So, if you
2814register with STAF, and then someone queues you a message, you can retrieve
2815it off your handle's queue.  The STAF command line utility works just like
2816any other STAF application.  It registers with STAF, performs a request (which
2817is the service request you specify), and then unregisters.  That last step
2818causes the handle to be deleted.  Every time you run the STAF command line
2819utility it gets a different handle.  When the process you started finishes,
2820it tried to send the message to the queue of a handle that no longer existed.
2821If you were to do a queue list, you would be listing the queue of a completely
2822different handle than the one that submitted the "process start" request.
2823</p><p>
2824If you were doing all of this inside a program, then it would have worked
2825like you anticipated.  From the command line, you can simulate it by:
2826</p><div class="orderedlist"><ol type="1"><li><p>
2827Open another window and have it use the delay command to wait for a while.
2828For example:
2829</p><pre class="screen">
2830<span><b class="command">STAF local delay delay 300000</b></span>
2831</pre><p>
2832</p></li><li><p>
2833See what handle the other window is using.  For example:
2834</p><pre class="screen">
2835<span><b class="command">STAF local handle query all</b></span>
2836</pre><p>
2837</p><p>
2838It should be the lowest numbered handle called "STAF/Client".
2839</p><p>
2840</p></li><li><p>
2841Start the process and specify the specific handle to queue the message
2842to.  For example:
2843</p><pre class="screen">
2844<span><b class="command">STAF local process start command clock notify onend handle <i class="replaceable"><tt>handle_from_step_2</tt></i></b></span>
2845</pre><p>
2846</p></li><li><p>
2847Stop the process, as you did previously.
2848</p></li><li><p>
2849Check the other window's queue,  For example:
2850</p><pre class="screen">
2851<span><b class="command">STAF local queue list handle <i class="replaceable"><tt>handle_from_step_2</tt></i></b></span>
2852</pre><p>
2853</p><p>
2854Note, when the delay request finishes (after 5 minutes in this case), the
2855handle and it's queue will disappear.
2856</p><p>
2857</p></li></ol></div><p>
2858</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1902"></a><a name="d0e1903"></a><b>3.4.4.</b></td><td align="left" valign="top"><p>Why are child processes not killed on Windows?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2859If you terminate a STAX job (or send a Process Stop request to a running
2860STAF process) on Windows, any child processes that the process has created
2861will not be terminated.  This is a limitation on Windows platforms.
2862To resolve this problem you can specify the option:
2863<span><b class="command">STOPUSING WM_CLOSE</b></span> on the PROCESS START request, or specify
2864the <span><b class="command">&lt;stopusing&gt;'WM_CLOSE'&lt;/stopusing&gt;</b></span> element for a
2865STAX &lt;process&gt; element.
2866</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1916"></a><a name="d0e1917"></a><b>3.4.5.</b></td><td align="left" valign="top"><p>
2867Why can't a STAF process log its output to an AFS directory?
2868</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2869When attempting to start a Process on a remote machine so that the output
2870can be logged to an AFS directory, STAFProc needs to be started in an
2871authenticated "session" in order to be able to store the log files in AFS-space.
2872</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1924"></a><a name="d0e1925"></a><b>3.4.6.</b></td><td align="left" valign="top"><p>
2873Why do I get a SIGABRT after a STAF process has completed on HP-UX?
2874</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2875If you see the following error on an HP-UX machine after a STAF process
2876has completed:
2877</p><pre class="screen">
2878Received signal 6 (SIGABRT)
2879/usr/lib/dld.sl: Call to __sigenable() failed
2880/usr/lib/dld.sl: Not owner
2881Received signal 6 (SIGABRT)
2882/usr/lib/dld.sl: Unresolved symbol: __h_errno__Fv (code)  from
2883/usr/local/staf/l
2884ib/libSTAF.sl
2885Received signal 6 (SIGABRT)
2886/usr/lib/dld.sl: Call to __sigenable() failed
2887/usr/lib/dld.sl: Not owner
2888Received signal 6 (SIGABRT)
2889/usr/lib/dld.sl: Unresolved symbol: __h_errno__Fv (code)  from
2890/usr/local/staf/l
2891</pre><p>
2892</p><p>
2893This is likely due to an incorrect hostname.  Verify that the DNS is setup
2894correctly an all machines (Refer to
2895<a href="#STAF machines can't communicate due to DNS issues">
2896"Why can't my STAF machines communicate?"</a>).
2897</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1940"></a><a name="d0e1941"></a><b>3.4.7.</b></td><td align="left" valign="top"><p>
2898Explain error message: "STAFProcessManager::processMonitorThread: Parent
2899could not set child's pgid: 13"
2900</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2901Periodically on Unix systems, you may see this error message.  You can ignore
2902these messages (you should not encounter any problems because of the messages).
2903</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1948"></a><a name="d0e1949"></a><b>3.4.8.</b></td><td align="left" valign="top"><p>
2904Explain Unix error message: STAFProcessManager::processMonitorThread: Could not
2905start process (execve): 8
2906</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2907If you get this error message when trying to start a process on a Unix
2908system, the 8 in the error message is the errno that is being set by the
2909operating system. For example, an errno of 8 on a Solaris 5.7 system, according
2910to the /usr/include/sys/errno.h file, means "Exec format error". This indicates
2911that there is a problem with the executable you specified in the process
2912start command. If you specified a shell script, check to see if it is missing
2913#! on the first line. Check if you can execute the same command (and parameters,
2914if specified) without involving STAF.
2915</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1956"></a><a name="d0e1957"></a><b>3.4.9.</b></td><td align="left" valign="top"><p>
2916When running the ftp executable for Windows via a PROCESS START request, why aren't I getting the remote server responses in stdout?
2917</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
2918When using the PROCESS service to run command "ftp -s:C:/temp/stdin.txt" on a Windows machine, where
2919C:/temp/stdin.txt is a text file that contains the FTP commands to run after FTP starts, if you
2920don't specify the SAMECONSOLE option (e.g. if you use the NEWCONSOLE option which is
2921the default),, the remote server responses are not written to stdout.
2922However, if you can specify the -v option for the ftp executable when using new console, then
2923the remote server response are written to stdout.  For example:  "ftp -v -s:C:/temp/stdin.txt".
2924When you specify the SAMECONSOLE option, the remote server responses are written to
2925stdout when you don't use the -v option for the ftp executable.
2926</p><p>
2927For example, say file C:\temp\stdin.txt contains the following content to log on to
2928remote ftp server machine staf1e and and put a file on the remote ftp server:
2929</p><pre class="programlisting">
2930open staf1e
2931root
2932mypassword
2933binary
2934cd sharon
2935put copyme.txt
2936bye
2937</pre><p>
2938Here are the results when using the PROCESS service to run the ftp executable when
2939using various options:
2940</p><p>
29411) When using new console (the default) and not using the -v option for the ftp executable, you see
2942that the remote server responses are not written to stdout:
2943</p><pre class="programlisting">
2944C:\&gt;STAF local PROCESS START COMMAND "ftp -s:C:/temp/stdin.txt" RETURNSTDOUT STDERRTOSTDOUT WAIT
2945Response
2946--------
2947{
2948  Return Code: 0
2949  Key        : &lt;None&gt;
2950  Files      : [
2951    {
2952      Return Code: 0
2953      Data       : User (staf1e.austin.ibm.com:(none)): open staf1e
2954
2955
2956
2957binary
2958cd sharon
2959put copyme.txt
2960bye
2961
2962    }
2963  ]
2964}
2965</pre><p>
29662) When using new console (the default) and the -v option for the ftp executable, you see
2967that the remote server responses are written to stdout:
2968</p><pre class="programlisting">
2969C:\&gt;STAF local PROCESS START COMMAND "ftp -v -s:C:/temp/stdin.txt" RETURNSTDOUT STDERRTOSTDOUT WAIT
2970Response
2971--------
2972{
2973  Return Code: 0
2974  Key        : &lt;None&gt;
2975  Files      : [
2976    {
2977      Return Code: 0
2978      Data       : Connected to staf1e.austin.ibm.com.
2979open staf1e
2980220 (vsFTPd 2.0.1)
2981User (staf1e.austin.ibm.com:(none)):
2982331 Please specify the password.
2983
2984230 Login successful.
2985
2986binary
2987200 Switching to Binary mode.
2988cd sharon
2989250 Directory successfully changed.
2990put copyme.txt
2991200 PORT command successful. Consider using PASV.
2992150 Ok to send data.
2993226 File receive OK.
2994ftp: 24 bytes sent in 0.00Seconds 24000.00Kbytes/sec.
2995bye
2996221 Goodbye.
2997
2998    }
2999  ]
3000}
3001</pre><p>
30023) When using the SAMECONSOLE option and not using the -v option for the ftp executable, you see
3003that the remote server responses are written to stdout:
3004</p><pre class="programlisting">
3005C:\&gt;STAF local PROCESS START COMMAND "ftp -s:C:/temp/stdin.txt" RETURNSTDOUT STDERRTOSTDOUT WAIT SAMECONSOLE
3006Response
3007--------
3008{
3009  Return Code: 0
3010  Key        : &lt;None&gt;
3011  Files      : [
3012    {
3013      Return Code: 0
3014      Data       : ftp&gt; Connected to staf1e.austin.ibm.com.
3015open staf1e
3016220 (vsFTPd 2.0.1)
3017User (staf1e.austin.ibm.com:(none)):
3018331 Please specify the password.
3019
3020230 Login successful.
3021ftp&gt; ftp&gt;
3022binary
3023200 Switching to Binary mode.
3024ftp&gt; cd sharon
3025250 Directory successfully changed.
3026ftp&gt; put copyme.txt
3027200 PORT command successful. Consider using PASV.
3028150 Ok to send data.
3029226 File receive OK.
3030ftp: 24 bytes sent in 0.00Seconds 24000.00Kbytes/sec.
3031ftp&gt; bye
3032221 Goodbye.
3033
3034    }
3035  ]
3036}
3037</pre><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e1982"></a><a name="d0e1983"></a><b>3.4.10.</b></td><td align="left" valign="top"><p>Why do Expect scripts fail on Linux when STAFProc has been started
3038during system reboot?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3039When executing Expect scripts on a Linux system where STAFProc has been started
3040during the system reboot, the scripts may fail to perform the expected interactive
3041steps.  Here is an example Expect script:
3042</p><pre class="screen">
3043package require Expect
3044spawn scp root@abc.company.com:/root/test/xyz.err /tmp/myxyz.err
3045expect "root@abc.company.com's password:"
3046send "**********\n"
3047interact
3048</pre><p>
3049This script will copy a remote file to the system where the script is
3050executing.  Here is an example of running the script via STAF (where STAFProc
3051has been started after the system boots):
3052</p><pre class="screen">
3053# STAF &lt;machine&gt; PROCESS START SHELL COMMAND "/opt/ActiveTcl-8.5/bin/tclsh8.5 /home/expect.tcl" RETURNSTDOUT STDERRTOSTDOUT WAIT
3054Response
3055--------
3056{
3057  Return Code: 0
3058  Key        : &lt;None&gt;
3059  Files      : [
3060    {
3061      Return Code: 0
3062      Data       : spawn scp root@abc.company.com:/root/test/xyz.err /tmp/
3063myxyz.err
3064root@abc.company.com's password:
3065myxyz.err                                       100% 5085     5.0KB/s   00:00
3066
3067    }
3068  ]
3069}
3070</pre><p>
3071Notice that the standard output includes the information about the copied file
3072(myxyz.err 100% 5085 5.0KB/s 00:00) and the /tmp/myxyz.err file exists.
3073</p><p>
3074However, if you configure the system to start STAFProc automatically during
3075reboot, using something like:
3076</p><pre class="screen">
3077nohup /usr/local/staf/bin/STAFProc &gt; /usr/local/staf/stafproc.out &amp;
3078</pre><p>
3079After the system reboots, here is an example of running the script via STAF:
3080</p><pre class="screen">
3081# STAF &lt;machine&gt; PROCESS START SHELL COMMAND "/opt/ActiveTcl-8.5/bin/tclsh8.5 /home/expect.tcl" RETURNSTDOUT STDERRTOSTDOUT WAIT
3082Response
3083--------
3084{
3085  Return Code: 0
3086  Key        : &lt;None&gt;
3087  Files      : [
3088    {
3089      Return Code: 0
3090      Data       : spawn scp root@abc.company.com:/root/test/xyz.err /tmp/
3091myxyz.err
3092root@abc.company.com's password:
3093
3094    }
3095  ]
3096}
3097</pre><p>
3098Notice that the standard output does not include the information about the
3099copied file, and the /tmp/myxyz.err file does not exist.
3100</p><p>
3101The root cause of the problem is that STAFProc is being started in the
3102background (using &amp;) when the system is rebooted; in this scenario the
3103Expect scripts will fail.  Note that if you start STAFProc in the background
3104(using &amp;) after the system has booted, the Expect scripts will run
3105successfully.
3106</p><p>
3107There are two workarounds for the problem:
3108</p><div class="itemizedlist"><ul type="disc"><li>
3109Start STAFProc after the system has rebooted.
3110<pre class="screen"></pre></li><li>
3111Start STAFProc in the foreground during the system boot (i.e. remove
3112the &amp; when starting STAFProc).  WARNING -- use caution when using this
3113workaound, as it may cause your operating system to hang during the boot.
3114<div class="itemizedlist"><ul type="circle"><li>
3115On SLES10, this workaround has been successful when the /etc/sysconfig/boot
3116has RUN_PARALLEL=yes (so that services, including STAF, will start in parallel).
3117So, even though the script that starts STAFProc will hang, this will not cause
3118the system boot to hang.
3119</li></ul></div></li></ul></div><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2017"></a><a name="d0e2018"></a><b>3.4.11.</b></td><td align="left" valign="top"><p>Why is different output returned by some commands such as "reg query"
3120when run using a win32 version of STAF on a Windows 64-bit system?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3121When running a win32 version of STAF on a Windows 64-bit system, the output
3122returned from some commands such as "reg query" when run via a STAF PROCESS
3123START request may be different than when running the command via a command
3124prompt.  For example, when running a "reg query HKLM\Software" command via
3125an "Administrator: C:\Windows\System\cmd.exe" command prompt, the result
3126could be:
3127</p><pre class="programlisting">
3128C:\&gt;reg query HKLM\Software
3129
3130HKEY_LOCAL_MACHINE\Software\Classes
3131HKEY_LOCAL_MACHINE\Software\Clients
3132HKEY_LOCAL_MACHINE\Software\JavaSoft
3133HKEY_LOCAL_MACHINE\Software\Lotus
3134HKEY_LOCAL_MACHINE\Software\Microsoft
3135HKEY_LOCAL_MACHINE\Software\MozillaPlugins
3136HKEY_LOCAL_MACHINE\Software\ODBC
3137HKEY_LOCAL_MACHINE\Software\Policies
3138HKEY_LOCAL_MACHINE\Software\RegisteredApplications
3139HKEY_LOCAL_MACHINE\Software\Symantec
3140HKEY_LOCAL_MACHINE\Software\Wow6432Node
3141
3142C:\&gt;
3143</pre><p>
3144</p><p>
3145But, when the same "reg query HKLM\Software" command is run via a STAF PROCESS
3146START request, the result could be different:
3147</p><pre class="programlisting">
3148C:\&gt;STAF local PROCESS START SHELL COMMAND "reg query HKLM\Software" RETURNSTDOUT STDERRTOSTDOUT WAIT
3149Response
3150--------
3151{
3152  Return Code: 0
3153  Key        : &amp;lt;None&gt;
3154  Files      : [
3155    {
3156      Return Code: 0
3157      Data       :
3158HKEY_LOCAL_MACHINE\Software\Microsoft
3159HKEY_LOCAL_MACHINE\Software\Mozilla
3160HKEY_LOCAL_MACHINE\Software\MozillaPlugins
3161HKEY_LOCAL_MACHINE\Software\ODBC
3162HKEY_LOCAL_MACHINE\Software\SNIA
3163HKEY_LOCAL_MACHINE\Software\Symantec
3164HKEY_LOCAL_MACHINE\Software\Classes
3165HKEY_LOCAL_MACHINE\Software\Clients
3166HKEY_LOCAL_MACHINE\Software\Policies
3167HKEY_LOCAL_MACHINE\Software\RegisteredApplications
3168
3169    }
3170  ]
3171}
3172</pre><p>
3173</p><p>
3174This is because a 32-bit version of STAF (or any 32-bit application) can only
3175run processes in 32-bit mode (SysWOW64). Additionally, a 32-bit application
3176cannot retrieve file information about any files in the System32 folder or in
3177the subfolders of the System32 folder.  So running the command via STAF PROCESS
3178START request, you get the same result as if you ran the command via an
3179"Administrator: C:\Windows\SysWOW64\cmd.exe" command prompt.
3180</p><p>
3181If you want to get the same output as when running the command via an
3182"Administrator: C:\Windows\System32\cmd.exe" command prompt, you could do
3183one of the following:
3184</p><div class="itemizedlist"><ul type="disc"><li>
3185Use C:\Windows\Sysnative in the PATH to run the command instead of using
3186C:\Windows\System32.  You can do this by using the ENV option on your PROCESS
3187START request to include C:\Windows\Sysnative at the beginning of the PATH
3188environment variable.  Note that you can specify STAF variable
3189{STAF/Env/SystemRoot} instead of hardcoding C:\Windows in case you may have
3190Windows installed on a drive other than C:.  For example:
3191<pre class="programlisting">
3192C:\&gt;STAF local PROCESS START SHELL COMMAND "reg query HKLM\Software" ENV "PATH={STAF/Env/SystemRoot}\Sysnative;{STAF/Env/PATH}" RETURNSTDOUT STDERRTOSTDOUT WAIT
3193Response
3194--------
3195{
3196  Return Code: 0
3197  Key        : &amp;lt;None&gt;
3198  Files      : [
3199    {
3200      Return Code: 0
3201      Data       :
3202HKEY_LOCAL_MACHINE\Software\Classes
3203HKEY_LOCAL_MACHINE\Software\Clients
3204HKEY_LOCAL_MACHINE\Software\JavaSoft
3205HKEY_LOCAL_MACHINE\Software\Lotus
3206HKEY_LOCAL_MACHINE\Software\Microsoft
3207HKEY_LOCAL_MACHINE\Software\MozillaPlugins
3208HKEY_LOCAL_MACHINE\Software\ODBC
3209HKEY_LOCAL_MACHINE\Software\Policies
3210HKEY_LOCAL_MACHINE\Software\RegisteredApplications
3211HKEY_LOCAL_MACHINE\Software\Symantec
3212HKEY_LOCAL_MACHINE\Software\Wow6432Node
3213
3214    }
3215  ]
3216}
3217
3218</pre>
3219Or you could change the PATH environment variable in the environment in which
3220STAFProc is run to include C:\Windows\Sysnative before C:\Windows\System32.
3221Note that this would then effect all commands run via a PROCESS START request
3222which may or may not be what you want.
3223<p>
3224For more information on using C:\Windows\Sysnative, see "Batch Script Question
3225- REG QUERY results" at
3226<a href="http://social.technet.microsoft.com/Forums/en-US/35cb7eb4-1da4-4cb5-95e8-6932e06cf528/batch-script-question-reg-query-results?forum=ITCG" target="_top">
3227Batch Script Question - REG QUERY results</a>.
3228</p></li><li>
3229Install a 64-bit version of STAF for Windows (e.g. winamd64) instead
3230of using a win32 version of STAF on your 64-bit Windows operating system.
3231Note that there could be other factors that influence whether or not you decide
3232to install a 64-bit version of STAF (e.g. if you need to use a 32-bit version
3233of Java instead of a 64-bit version of Java to run STAF Java services).
3234</li></ul></div><p></p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e2050"></a><h4 class="title"><a name="d0e2050"></a>3.5. FS Service Questions</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>3.5.1. <a href="#d0e2053">Why does COPY FILE request fail when no TOMACHINE is specified?</a></dt><dt>3.5.2. <a href="#d0e2090">
3235Why are my text files copied via the FS service not converted correctly
3236between Windows and Unix?
3237</a></dt><dt>3.5.3. <a href="#d0e2098">
3238Why can't I copy a file that is larger then 4GB?
3239</a></dt><dt>3.5.4. <a href="#d0e2111">
3240Why does FS LIST COPYREQUESTS show a copy request in progress on the destination machine
3241that has already failed with a RC 22?
3242</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2053"></a><a name="d0e2054"></a><b>3.5.1.</b></td><td align="left" valign="top"><p>Why does COPY FILE request fail when no TOMACHINE is specified?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3243From machine m1 this command fails:
3244</p><pre class="screen">
3245<span><b class="command"><tt class="prompt">C:\&gt;</tt>STAF m2 FS COPY FILE c:/staf/data/log/global/temp.log TOFILE c:/staf/data/log/global/archivetemp.log</b></span>
3246Error submitting request, RC: 17
3247Additional info: c:/staf/data/log/global/archivetemp.log
3248</pre><p>
3249</p><p>
3250From machine m1 this command works:
3251</p><pre class="screen">
3252<span><b class="command"><tt class="prompt">C:\&gt;</tt>STAF m2 FS COPY FILE c:/staf/data/log/global/temp.log TOFILE c:/staf/data/log/global/archivetemp.log TOMACHINE m2</b></span>
3253</pre><p>
3254</p><p>
3255This is working as expected/designed.  The default for the TOMACHINE
3256option is the system that originated the request.  So, if <span><b class="command">m1</b></span>
3257does not actually have a c:/staf/data/log/global directory, then STAF will not
3258be able to create the archivetemp.log directory.  Once you add
3259<span><b class="command">TOMACHINE m2</b></span>, it is obvious you were trying to copy a file
3260"locally" on the remote system, which does require the use of the
3261<span><b class="command">TOMACHINE</b></span> option.
3262</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2090"></a><a name="d0e2091"></a><b>3.5.2.</b></td><td align="left" valign="top"><p>
3263Why are my text files copied via the FS service not converted correctly
3264between Windows and Unix?
3265</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3266Beginning with STAF 2.5.0 and later, you can use a TEXT option on a FS
3267COPY FILE or GET FILE request (or TEXTEXT options on a FS COPY DIRECTORY request) to
3268convert line-endings between Windows and Unix and to convert between
3269codepages if necessary.  See the "File System (FS) Service" section of the
3270STAF User's Guide for more information.
3271</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2098"></a><a name="d0e2099"></a><b>3.5.3.</b></td><td align="left" valign="top"><p>
3272Why can't I copy a file that is larger then 4GB?
3273</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3274The STAF FS Service does not currently support copying files that are &gt;= 4GB (4,294,967,296 bytes),
3275even on 64-bit machines.
3276<a href="http://sourceforge.net/p/staf/feature-requests/438/" target="_top">
3277Feature Request #438</a> has been opened to add support to the FS service for
3278copying files that are &gt;= 4GB.  There is no planned implementation date at this time.
3279
3280.</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2111"></a><a name="d0e2112"></a><b>3.5.4.</b></td><td align="left" valign="top"><p>
3281Why does FS LIST COPYREQUESTS show a copy request in progress on the destination machine
3282that has already failed with a RC 22?
3283</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3284If a FS COPY request fails due to a network problem such as with RC: 22 and Result:
3285"STAFConnectionWrite: Error writing to socket: send() RC=10054: 22", it's possible that
3286half of the connection on the destination ("TO") machine side didn't get closed. So, it still shows up
3287in the FS LIST COPYREQUESTS LONG request on the destination machine (even though the
3288copy request is no longer running) and it causes RC 19 if you resubmit this FS COPY request.
3289</p><p>
3290This occurs because the network connection on the FS COPY destination machine may not
3291be notified if the other side of the network connection ended unless keepalive is enabled and
3292the KeepAliveTime has expired.  Note that on Windows, keepalive is not enabled on a
3293Windows socket by default.  Keep Alive refers to the time before TCP will begin sending
3294keepalive messages, but only if keepalive is enabled for a network connection. The default is usually
3295around 2 hours. KeepAliveInterval is the time between retransmissions of keepalives
3296once a KeepAliveTime has expired.
3297</p><p>
3298To improve this problem:
3299</p><div class="orderedlist"><ol type="1"><li><p>
3300        Install STAF V3.2.0 or later as a bug fix was made in it that
3301        helps with this problem by enabling the TCP keepalive option for client sockets
3302        in the STAF TCP connection provider.</p></li><li>
3303        Also, you may want to decrease the TCP KeepAliveTime parameter from 2 hours to around 30 minutes.
3304        The following webpages contain information for tuning Windows TCP/IP:
3305        <div class="itemizedlist"><ul type="disc"><li>
3306            Refer to  <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;314053" target="_top">
3307            TCP/IP and NBT configuration parameters for Windows XP</a>
3308            to see how you can decrease the KeepAliveTime on Windows XP.
3309            </li><li>
3310            Refer to <a href="http://www.microsoft.com/technet/itsolutions/network/deploy/depovg/tcpip2k.mspx" target="_top">
3311            "Microsoft Windows 2000 TCP/IP Implementation Details"</a>
3312            to see how you can decrease the KeepAliveTime on Windows 2000.
3313            </li><li>
3314            Refer to <a href="http://www.anzio.com/support/whitepapers/tuning.htm" target="_top">
3315            "Hints for Tuning Microsoft Windows TCP/IP"</a>
3316            to see how you can decrease the KeepAliveTime on Windows 2000, NT, 95/98.
3317            </li></ul></div></li></ol></div><p></p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e2145"></a><h3 class="title"><a name="d0e2145"></a>4. Debugging STAX</h3></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>4.1.  <a href="#d0e2148">General Questions</a></dt><dd><dl><dt>4.1.1. <a href="#d0e2151">
3318Where can I find more information about Python?
3319</a></dt><dt>4.1.2. <a href="#d0e2193">
3320Why is STAX still showing a process as running, even though it has completed?
3321</a></dt><dt>4.1.3. <a href="#d0e2206">
3322Why am I getting RC=10 and STAFResult=8 when starting a Java process in a
3323STAX job?
3324</a></dt><dt>4.1.4. <a href="#d0e2219">
3325Why does my eMail Service's SEND request resulting in RC 7 when quotes or
3326double quotes are in the message?
3327</a></dt><dt>4.1.5. <a href="#d0e2229">
3328Why am I getting a java.lang.NullPointerException at org.python.core.ThreadState.entrRepr in my JVMLog.1 file?
3329</a></dt><dt>4.1.6. <a href="#d0e2266">
3330Why aren't changes to imported Python modules picked up in my STAX job?
3331</a></dt><dt>4.1.7. <a href="#RC 21 submitting a STAX EXECUTE request">Explain "RC 21 submitting a STAX EXECUTE request"</a></dt><dt>4.1.8. <a href="#d0e2419">
3332Why is the STAX JVM crashing with a java.lang.OutOfMemoryError
3333logged in the STAX JVM log?
3334</a></dt><dt>4.1.9. <a href="#d0e2460">
3335Why is the STAX JVM's maximum heap size limited to ~2G on a 32-bit system?
3336</a></dt></dl></dd><dt>4.2.  <a href="#d0e2494">STAX &lt;import&gt; Questions</a></dt><dd><dl><dt>4.2.1. <a href="#d0e2497">
3337Why aren't the global &lt;script&gt; elements in the imported XML file
3338executed when importing a STAX function from that file?
3339</a></dt><dt>4.2.2. <a href="#d0e2509">
3340Are there any conflict or efficiency concerns when doing nested file imports
3341in a STAX job?
3342</a></dt></dl></dd><dt>4.3.  <a href="#d0e2605">STAX Monitor Questions</a></dt><dd><dl><dt>4.3.1. <a href="#d0e2608">What does RC 2 mean when starting the STAX Job Monitor?</a></dt><dt>4.3.2. <a href="#d0e2616">What does RC 16 mean when starting the STAX Job Monitor?</a></dt><dt>4.3.3. <a href="#d0e2624">
3343What does RC 2 mean when submitting a new job via the STAX Job Monitor?
3344</a></dt><dt>4.3.4. <a href="#d0e2632">
3345What does RC 16 mean when submitting a new job via the STAX Job Monitor?
3346</a></dt><dt>4.3.5. <a href="#d0e2640">
3347Why I'm I getting a java.util.zip.ZipException running "java -jar STAXMon.jar"?
3348</a></dt><dt>4.3.6. <a href="#d0e2654">
3349Why doesn't the STAX Job Monitor window have a close confirmation?
3350</a></dt></dl></dd></dl></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e2148"></a><h4 class="title"><a name="d0e2148"></a>4.1. General Questions</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>4.1.1. <a href="#d0e2151">
3351Where can I find more information about Python?
3352</a></dt><dt>4.1.2. <a href="#d0e2193">
3353Why is STAX still showing a process as running, even though it has completed?
3354</a></dt><dt>4.1.3. <a href="#d0e2206">
3355Why am I getting RC=10 and STAFResult=8 when starting a Java process in a
3356STAX job?
3357</a></dt><dt>4.1.4. <a href="#d0e2219">
3358Why does my eMail Service's SEND request resulting in RC 7 when quotes or
3359double quotes are in the message?
3360</a></dt><dt>4.1.5. <a href="#d0e2229">
3361Why am I getting a java.lang.NullPointerException at org.python.core.ThreadState.entrRepr in my JVMLog.1 file?
3362</a></dt><dt>4.1.6. <a href="#d0e2266">
3363Why aren't changes to imported Python modules picked up in my STAX job?
3364</a></dt><dt>4.1.7. <a href="#RC 21 submitting a STAX EXECUTE request">Explain "RC 21 submitting a STAX EXECUTE request"</a></dt><dt>4.1.8. <a href="#d0e2419">
3365Why is the STAX JVM crashing with a java.lang.OutOfMemoryError
3366logged in the STAX JVM log?
3367</a></dt><dt>4.1.9. <a href="#d0e2460">
3368Why is the STAX JVM's maximum heap size limited to ~2G on a 32-bit system?
3369</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2151"></a><a name="d0e2152"></a><b>4.1.1.</b></td><td align="left" valign="top"><p>
3370Where can I find more information about Python?
3371</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><div class="itemizedlist"><ul type="disc"><li><p>
3372Main Python doc page:  <a href="http://www.python.org/doc/" target="_top">
3373http://www.python.org/doc/</a>
3374</p></li><li><p>
3375Library reference:  <a href="http://www.python/org/doc/current/lib/lib.html" target="_top">
3376http://www.python.org/doc/current/lib/lib.html</a>
3377</p></li><li><p>
3378Language reference:  <a href="http://www.python.org/doc/current/ref/ref/html" target="_top">
3379http://www.python.org/doc/current/ref/ref.html</a>
3380</p></li><li><p>
3381Info on re:  <a href="http://www.python.org/doc/current/lib/module-re.html" target="_top">
3382http://www.python.org/doc/current/lib/module-re.html</a>
3383</p></li><li><p>
3384Info on import:  <a href="http://www.python.org/doc/current/ref/import.html" target="_top">
3385http://www.python.org/doc/current/ref/import.html</a>
3386</p></li><li><p>
3387Python book reviews:  <a href="http://www.awaretek.com/book.html" target="_top">
3388http://www.awaretek.com/book.html</a>
3389</p></li></ul></div></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2193"></a><a name="d0e2194"></a><b>4.1.2.</b></td><td align="left" valign="top"><p>
3390Why is STAX still showing a process as running, even though it has completed?
3391</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3392If you are running a STAX Job, and it shows that a process is still
3393running, even though the process has actually completed, this is likely
3394a DNS problem with either the STAX service machine or the machine where
3395the process was executed (where the machine that executed the process is
3396unable to find the STAX service machine in order to deliver the process
3397completion message).
3398</p><p>
3399Refer to <a href="#STAF machines can't communicate due to DNS issues">
3400"Why can't my STAF machines communicate?"</a> to resolve this problem.
3401</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2206"></a><a name="d0e2207"></a><b>4.1.3.</b></td><td align="left" valign="top"><p>
3402Why am I getting RC=10 and STAFResult=8 when starting a Java process in a
3403STAX job?
3404</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3405Certain Unix Java versions will contain a /bin/java file that is actually
3406a soft link to a wrapper shell script file, rather than a binary executable
3407file.  If you try to start a Java process in a STAX job:
3408</p><pre class="programlisting">
3409&lt;process&gt;
3410  &lt;location&gt;machName&lt;/location&gt;
3411  &lt;command&gt;'java'&lt;/command&gt;
3412  &lt;parms&gt;'TestA'&lt;/parms&gt;
3413&lt;/process&gt;
3414</pre><p>
3415the result will be RC=10 and STAFResult=8.  The Operating System return
3416code 8 indicates "Exec format error".  To resolve this problem, specify the
3417'shell' attribute:
3418</p><pre class="programlisting">
3419&lt;process&gt;
3420  &lt;location&gt;machName&lt;/location&gt;
3421  &lt;command mode="'shell'"&gt;'java'&lt;/command&gt;
3422  &lt;parms&gt;'TestA'&lt;/parms&gt;
3423&lt;/process&gt;
3424</pre><p>
3425</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2219"></a><a name="d0e2220"></a><b>4.1.4.</b></td><td align="left" valign="top"><p>
3426Why does my eMail Service's SEND request resulting in RC 7 when quotes or
3427double quotes are in the message?
3428</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3429If the message request has embedded quotes or double quotes, it may
3430cause the STAF command parsing to fail (resulting in the RC 7).  Here
3431is a portion of a STAX job that shows how to get this working:
3432</p><pre class="programlisting">
3433&lt;script&gt;
3434  from com.ibm.staf import STAFUtil
3435  emailmessage = STAFUtil.wrapData(emailmessage)
3436&lt;/script&gt;
3437
3438&lt;stafcmd&gt;
3439  &lt;location&gt;'local'&lt;/location&gt;
3440  &lt;service&gt;'email'&lt;/service&gt;
3441  &lt;request&gt;'send to user@us.ibm.com message %s' %(emailmessage)&lt;/request&gt;
3442&lt;/stafcmd&gt;
3443
3444&lt;if expr="RC !=0"&gt;
3445  &lt;message&gt;'RC: %s result: %s' % (RC, STAFResult)&lt;/message&gt;
3446&lt;/if&gt;
3447</pre><p>
3448</p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2229"></a><a name="d0e2230"></a><b>4.1.5.</b></td><td align="left" valign="top"><p>
3449Why am I getting a java.lang.NullPointerException at org.python.core.ThreadState.entrRepr in my JVMLog.1 file?
3450</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3451The following NullPointerException at org.python.core.ThreadState.enterRepr(ThreadState.java)
3452is a known problem in IBM Java's JIT:
3453</p><pre class="programlisting">
3454******************************************************************************
3455*** 20030911-12:50:41 - Start of Log for JVMName: STAFJVM1
3456*** JVM Executable: java
3457*** JVM Options   : -Xms128m -Xmx512m
3458******************************************************************************
3459java.lang.NullPointerException
3460    at org.python.core.ThreadState.enterRepr(ThreadState.java(Compiled Code))
3461    at org.python.core.PyList.toString(PyList.java(Compiled Code))
3462    at org.python.core.PyObject.__repr__(PyObject.java(Compiled Code))
3463    at org.python.core.PyObject.__str__(PyObject.java(Compiled Code))
3464    at com.ibm.staf.service.stax.STAXThread.pyStringEval(STAXThread.java(Compiled Code))
3465    at com.ibm.staf.service.stax.STAXMessageAction.execute(STAXMessageAction.java(Compiled Code))
3466    at com.ibm.staf.service.stax.STAXThread.execute(STAXThread.java(Compiled Code))
3467    at com.ibm.staf.service.stax.STAXThreadQueue$QueueThread.run(STAXThreadQueue.java:66)
3468</pre><p>
3469If you see this NullPointerException in your JVMLog.1 file when debugging a problem
3470running a STAX job, verify that the JVM that STAX is using is IBM's java by doing:
3471</p><pre class="screen">
3472<span><b class="command">  java -version</b></span>
3473</pre><p>
3474This problem is in the JIT in IBM Java versions 1.3.x, 1.4.0, and 1.4.1 and has
3475been seen on both Windows and Unix systems.
3476This problem has been reported to IBM Java support and is under investigation.
3477When this NullPointerException occurs in the JVM, any services using this JVM can
3478no longer function until the services using this JVM are removed and re-added via
3479the SERVICE service or STAFProc is shutdown and restarted.
3480</p><p>
3481There are two workarounds:
3482</p><div class="orderedlist"><ol type="1"><li><p>
3483    Disable the JIT (which will degrade performance):
3484    </p><p>
3485    To turn the JIT off for the JVM that the STAX service is using, configure the
3486    STAX service using a J2 OPTION to set the java.compiler property to NONE.  For example:
3487</p><pre class="screen"><span><b class="command">SERVICE STAX LIBRARY JSTAF EXECUTE C:\STAF\services\services\stax\STAX.jar \
3488             OPTION JVMName=STAX OPTION J2=-Xmx256m \
3489             OPTION J2=-Djava.compiler=NONE</b></span></pre><p>
3490    </p></li><li><p>
3491     Use another version of Java (e.g. Oracle Java) instead of IBM Java:
3492    </p><p>
3493    To specify another version of Java for the STAX service to use, configure
3494    the STAX service using the JVM OPTION to set the Java executable.  For example, if
3495    you install Oracle Java 7.0 in C:\jdk7.0, then configure STAX as follows to
3496    specify to use the java executable in the C:\jdk7.0\bin directory:
3497</p><pre class="screen"><span><b class="command">SERVICE STAX LIBRARY JSTAF EXECUTE C:\STAF\services\services\stax\STAX.jar \
3498             OPTION JVM=C:\jdk7.0\bin\java \
3499             OPTION JVMName=STAX OPTION J2=-Xmx512m</b></span></pre><p>
3500    </p></li></ol></div></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2266"></a><a name="d0e2267"></a><b>4.1.6.</b></td><td align="left" valign="top"><p>
3501Why aren't changes to imported Python modules picked up in my STAX job?
3502</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3503Use the built-in Python "reload" function if you want to pick up changes
3504made to imported Python modules without having to unregister and register
3505the STAX service (either by stopping STAF and restarting it or by using
3506the SERVICE service to dynamically delete and add the STAX service). Note
3507that there is a "gotcha" in that reload may not impact "from" imports.
3508Reloading allows you to test Python module changes immediately after reloads,
3509without having to unregister the STAX service. Here's more detailed information
3510about using the built-in Python "reload" function.
3511</p><p>
3512One of the most common questions Python beginners seem to ask when using
3513modules is: why won't my imports keep working? The first import works fine,
3514but later imports in STAX jobs seem to have no effect. They're not supposed
3515to, and here's why:
3516</p><div class="itemizedlist"><ul type="disc"><li>
3517Modules are loaded and run on the first <span><b class="command">import</b></span> or
3518<span><b class="command">from</b></span></li><li>
3519Running a module's code creates its top-level names.
3520</li><li>
3521Later <span><b class="command">import</b></span> and <span><b class="command">from</b></span> operations
3522fetch an already loaded module.
3523</li></ul></div><p>
3524Python loads, compiles, and runs code in a module file only on the
3525<span class="emphasis"><em>first</em></span> import, on purpose; since this is an
3526expensive operation. So, even across STAX jobs, a Python module's code is run
3527only once per STAX service by default. But, sometimes you really want a
3528module's code to be rerun.
3529</p><p>
3530To force a module's code to be reloaded and rerun, you need to ask Python
3531explicitly to do so, by calling the <span><b class="command">reload</b></span> built-in
3532function.  Using <span><b class="command">reload</b></span> can make your STAX jobs more
3533dynamic. In a nutshell:
3534</p><div class="itemizedlist"><ul type="disc"><li>
3535Imports load and run a module's code only the first time.
3536</li><li>
3537Later imports use the already loaded module object without rerunning code.
3538</li><li>
3539The reload function forces an already loaded module's code to be reloaded
3540and rerun.
3541</li></ul></div><p>
3542Unlike <span><b class="command">import</b></span> and <span><b class="command">from</b></span>:
3543</p><div class="itemizedlist"><ul type="disc"><li><span><b class="command">reload</b></span> is a built-in function in Python, not a statement.
3544</li><li><span><b class="command">reload</b></span> is passed an existing module object, not a name.
3545</li></ul></div><p>
3546Because <span><b class="command">reload</b></span> expects an object, a module must have been
3547previously imported successfully before you can reload it. Reloading looks like
3548this:
3549</p><pre class="programlisting">
3550  import module     # initial import
3551  #  Use module.attributes
3552  ...               # now, go change the module file
3553  ...
3554  reload(module)    # get updated exports
3555  # Use module.attributes
3556</pre><p>
3557You typically import a module, then change its source code in a text editor
3558and reload. When you call <span><b class="command">reload</b></span>, Python rereads the module
3559file's source code and reruns its top-level statements and changes a module
3560object <span class="emphasis"><em>in-place</em></span>,
3561so every reference to a module object is automatically effected by a
3562<span><b class="command">reload</b></span>.
3563</p><p>
3564Note that there is an important "gotcha" in that reload may not impact
3565<span><b class="command">from</b></span>imports. In fact, the <span><b class="command">from</b></span> statement
3566is the source of all sorts of gotchas in Python. Because
3567<span><b class="command">from</b></span> copies (assigns) names when run, there's no link back
3568to the module where the names came from. Names imported with
3569<span><b class="command">from</b></span> simply become references to objects, which happen to
3570have been referenced by the same names in the importee when the
3571<span><b class="command">from</b></span> ran. Because of this behavior, reloading the importee
3572has no effect on clients that use <span><b class="command">from</b></span>; the client's names
3573still reference the objects fetched with <span><b class="command">from</b></span>, even though
3574names in the original module have been reset. For example:
3575</p><pre class="programlisting">
3576  from module import X     # X may not reflect any module reloads!
3577  ...
3578  reload(module)           # changes module, not my names
3579  X                        # still references old object
3580</pre><p>
3581The solution to this is: Don't do it that way. To make reloads more effective,
3582use import and name qualification, instead of <span><b class="command">from</b></span>. Because
3583qualifications always go back to the module, they will find the new bindings
3584of module names after calling <span><b class="command">reload</b></span>:
3585</p><pre class="programlisting">
3586  import module            # get module, not names
3587  ...
3588  reload(module)           # changes module in-place
3589  module.X                 # get current X; reflects module reloads
3590</pre><p>
3591So, let's say you have a Python file, changer.py, in directory /usr/mypyfuns
3592that contains a function called getValue. For example, say changer.py looks
3593like:
3594</p><pre class="programlisting">
3595  value = 'First value'
3596
3597  def getValue():
3598      return value
3599</pre><p>
3600Here's an example of a STAX job that tests reloading function getValue
3601from module changer in /usr/mypyfuns. If you run this job, even after editing
3602changer.py so that value is assigned some other value, you'll get the updated
3603value.
3604</p><div class="example"><a name="d0e2389"></a><p class="title"><b>Example&nbsp;14.&nbsp;
3605Reloading imported function getValue from module changer in /usr/mypyfuns
3606</b></p><pre class="programlisting">
3607&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
3608&lt;!DOCTYPE stax SYSTEM "stax.dtd"&gt;
3609
3610&lt;!--  Test reloading Python modules  --&gt;
3611
3612&lt;stax&gt;
3613
3614  &lt;defaultcall function="TestReload"/&gt;;
3615
3616  &lt;script&gt;
3617    myPythonDir = '/usr/mypyfuns'
3618
3619    import sys
3620    pythonpath = sys.path
3621
3622    # Append myPythonDir to sys.path if not already present
3623    if myPythonDir not in pythonpath:
3624      sys.path.append(myPythonDir)
3625
3626    # Import
3627    import changer
3628
3629    # Force new code to load/run
3630    reload(changer)
3631  &lt;/script&gt;
3632
3633  &lt;function name="TestReload"&gt;
3634    &lt;message&gt;'changer.getValue()=%s' % changer.getValue()&lt;/message&gt;
3635  &lt;/function&gt;
3636
3637&lt;/stax&gt;
3638</pre></div><p>
3639See Python documentation for more information about module reloads.
3640</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="RC 21 submitting a STAX EXECUTE request"></a><a name="d0e2398"></a><b>4.1.7.</b></td><td align="left" valign="top"><p>Explain "RC 21 submitting a STAX EXECUTE request"</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3641You can get this error if your system has exceeded the maximum number of files
3642that can be open.  Check your JVM log and see if you have lots of the
3643following error logged:
3644</p><pre class="programlisting">
3645Error accepting on server socket, socket RC: 24
3646</pre><p>
3647Check your STAX jobs and see if they use Jython's open() function
3648to open a file in a &lt;script&gt; element but aren't using Jython's
3649close() function to close the file.  If the file is opened within a loop construct
3650(or if the function this code is in is called many times or the STAX job
3651is run many times), many files could be left open, even after the STAX job(s) complete.
3652Unlike Python, Jython requires that you explicitly close files (otherwise they could
3653be left open for a long, long time until they are garbage collected).
3654</p><p>
3655You can run command <span><b class="command">lsof -p &lt;STAX JVM PID&gt;</b></span>
3656to see the names of the files that were opened by the STAX service and STAX jobs
3657(which can help you determine which STAX job(s) are leaving files open).
3658</p><p>
3659Refer to <a href="#Error accepting on server socket, socket RC: 24">
3660Explain "Error accepting on server socket, socket RC: 24"</a> for more information
3661on how to debug this problem by finding out what files are open.
3662</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2419"></a><a name="d0e2420"></a><b>4.1.8.</b></td><td align="left" valign="top"><p>
3663Why is the STAX JVM crashing with a <span><b class="command">java.lang.OutOfMemoryError</b></span>
3664logged in the STAX JVM log?
3665</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3666If the STAX JVM crashes and the STAX JVM log contains error
3667<span><b class="command">java.lang.OutOfMemoryError: Java heap space</b></span>,
3668try tuning the JVM by increasing the maximum heap size used by the JVM be specifying
3669JVM option -Xmx&lt;Size&gt; when registering the STAX service.  For example, to increase
3670the maximum heap size to 1024m, register the STAX service as follows in the STAF.cfg file:
3671</p><pre class="programlisting">
3672SERVICE STAX LIBRARY JSTAF EXECUTE {STAF/Config/STAFRoot}/services/stax/STAX.jar \
3673             OPTION JVMName=STAX OPTION J2=-Xmx1024m
3674</pre><p>
3675If the STAX JVM crashes and the STAX JVM log contains an error like
3676<span><b class="command">java.lang.OutOfMemoryError: PermGen space</b></span> or
3677<span><b class="command">java.lang.OutOfMemoryError: requested &lt;size&gt; bytes for &lt;reason&gt;. Out of
3678swap space?</b></span> in the STAX JVM log, try tuning the JVM by increasing the
3679maximum size (and possibly the initial size) of the permanent generation space used
3680by the JVM.  The permanent generation is the area of the heap where class and method
3681objects are stored.  If an application loads a very large number of classes, then the
3682maximum size of the permanent generation space might need to be increased using the
3683<span><b class="command">-XX:MaxPermSize</b></span> JVM option when registering the STAX service.
3684You may also want to increase the initial size of the permanent generation space by using
3685the <span><b class="command">-XX:PermSize</b></span> JVM option.
3686For example, to increase the maximum and initial sizes of the permanent generation space
3687to 256m (and to increase the maximum heap size to 1024m), register the STAX service as
3688follows in the STAF.cfg file:
3689</p><pre class="programlisting">
3690SERVICE STAX LIBRARY JSTAF EXECUTE {STAF/Config/STAFRoot}/services/stax/STAX.jar \
3691             OPTION JVMName=STAX \
3692             OPTION "J2=-Xmx1024m -XX:MaxPermSize=256m -XX:PermSize=256m"
3693</pre><p>
3694Also, if the STAX JVM log contains following memory allocation error, try increasing
3695the maximum heap space and/or the permanent generation size for the JVM as
3696described above to resolve the problem.
3697</p><pre class="programlisting">
3698terminate called after throwing an instance of 'std::bad_alloc'
3699  what():  std::bad_alloc
3700</pre><p>
3701For more information on tuning memory when using Oracle Java 1.6 see
3702<a href="http://www.oracle.com/technetwork/java/javase/index-137495.html#gbyuu" target="_top">
3703Chapter 3: Troubleshooting Memory Leaks</a> in the Troubleshooting Guide for Java SE 6
3704with HotSpot VM.
3705</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2460"></a><a name="d0e2461"></a><b>4.1.9.</b></td><td align="left" valign="top"><p>
3706Why is the STAX JVM's maximum heap size limited to ~2G on a 32-bit system?
3707</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3708On a 32-bit system with lots of memory (e.g. 8G), if registering a STAF Java service
3709like STAX fails when specifying a maximum heap size of ~2G of more (e.g.
3710<span><b class="command">OPTION J2=-Xmx2560m</b></span>) with an error like the following:
3711</p><pre class="programlisting">
3712JVMJ9VM015W Initialization error for library j9gc24(2): Failed to instantiate heap; 2560M requested
3713Could not create the Java virtual machine.
3714</pre><p>
3715you've probably run into a limitation using a 32-bit JVM because on most
3716operating systems running on a 32-bit architecture, processes (including the Java heap)
3717are limited to less than 2GB total memory.
3718</p><p>
3719For more information on Java heap size limitations when using a 32-bit JVM,
3720see question
3721<a href="http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#gc_heap_32bit" target="_top">
3722Why can't I get a larger heap with the 32-bit JVM?</a> in the Oracle Java FAQ.
3723which says, "If your application requires a very large heap you
3724should use a 64-bit VM on a version of the operating system that supports
372564-bit applications".
3726Some reasons behind the ~2GB limitation on Linux 32-bit systems are talked
3727about in discussion thread
3728<a href="http://www.theserverside.com/discussions/thread.tss?thread_id=26347" target="_top">
3729How to avoid 2GB memory limit of JVM in Linux</a>.
3730Also see forum thread
3731<a href="http://www.coderanch.com/t/544285/java/java/Java-Heap-Size" target="_top">Java Heap Size</a>
3732at the JavaRanch Java Forum which says:
3733</p><p>
3734"In most Operating Systems running on a 32-bit architecture, processes are limited to
3735less than 2GB total memory. This includes the Java heap, the process' heap and stack,
3736the memory used by JNI (if any), the thread stacks and other internal structures.
3737</p><p>
3738On a Sun Fire V440 w/ Solaris 9 and HotSpot JRE 5.0 the 32-bit heap limit is 4.3 GB.
3739</p><p>
3740In Linux (e.g. RHEL 4.0 and later) you can run a hugepage kernel and
3741JRockIt which gives a max 32-bit heap size of 2.7GB.
3742</p><p>
3743On MS Windows you can try something like /3GB or /PAE with JRockIt, but due to
3744the fact that the heap needs to be in consecutive memory, you'll end up with a heap
3745size of less than 2GB."
3746</p><p></p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e2494"></a><h4 class="title"><a name="d0e2494"></a>4.2. STAX &lt;import&gt; Questions</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>4.2.1. <a href="#d0e2497">
3747Why aren't the global &lt;script&gt; elements in the imported XML file
3748executed when importing a STAX function from that file?
3749</a></dt><dt>4.2.2. <a href="#d0e2509">
3750Are there any conflict or efficiency concerns when doing nested file imports
3751in a STAX job?
3752</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2497"></a><a name="d0e2498"></a><b>4.2.1.</b></td><td align="left" valign="top"><p>
3753Why aren't the global &lt;script&gt; elements in the imported XML file
3754executed when importing a STAX function from that file?
3755</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3756Global &lt;script&gt; elements defined in an XML file containing only functions
3757intended to be imported by the &lt;import&gt; element, are not recognized
3758in the body of the functions.
3759In the imported xml file, only the &lt;script&gt; elements contained within
3760the imported &lt;function&gt; will be executed.
3761</p><p>
3762Just to give a little history, in the early stages of STAX's life,
3763&lt;function&gt;s were not allowed to take arguments (and the &lt;import&gt;
3764element didn't exist either). Any data that you wanted to "pass into" a
3765function had to be previously set in existing variables. To that end,
3766it was necessary to allow &lt;script&gt; elements at the root of the document
3767so that default values could be fed into the functions.  However, once we
3768added argument passing to &lt;function&gt;s, we began encouraging that over
3769global &lt;script&gt;s.  Nevertheless, we couldn't remove support for global
3770&lt;script&gt;s, as many groups were already using them.
3771</p><p>
3772When we implemented the &lt;import&gt; element, we felt it would be cleaner
3773to just import the &lt;function&gt;s in the job, as there was less interaction
3774with the pieces of the importing job. For example, what you already had
3775a variable that was overwritten by a &lt;script&gt; in another file, just
3776because you imported a single utility &lt;function&gt; from it. Even if you
3777were expecting a certain variable to be set from the job, you would have
3778to be very careful to import the functions in the job first, and then set
3779the variables, otherwise your values would overwritten. This same line
3780of argument also applies to importing &lt;signalhandler&gt;s.
3781</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2509"></a><a name="d0e2510"></a><b>4.2.2.</b></td><td align="left" valign="top"><p>
3782Are there any conflict or efficiency concerns when doing nested file imports
3783in a STAX job?
3784</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3785<span><b class="command">Question:</b></span>  If I have a situation where file A imports
3786files B and C, and files B and C both import file D is that going to cause
3787any sort of conflict when a call is made to a function in file D?
3788</p><p>
3789<span><b class="command">Answer:</b></span>  No.
3790</p><p>
3791<span><b class="command">Question:</b></span>  If file A imports file B and file B imports
3792file C, does file C get re-imported every time the function in file B is
3793called?  If so is there any potential conflict there, and how much will
3794this impact overall efficiency?
3795</p><p>
3796<span><b class="command">Answer:</b></span>  No, functions in file C do not get re-imported
3797every time the function in file B is called.  However, we should point
3798out that file C will, in fact, be re-imported every time.  Now, none of the
3799functions in it will get imported, but the file will be retrieved and parsed
3800each time you try to import something from it.  Depending on how big this
3801file is, and how often you are calling the function which imports it, you
3802might either set a STAF variable (with the job number somewhere in it)
3803that you can retrieve across function calls, or have the importing function
3804use "global" scope and set a STAX variable that indicates the import has
3805already been done.
3806</p><p>
3807You can see this for yourself if you'd like by looking at STAXResult
3808after each &lt;import&gt; element.  In the STAX User's Guide, in the
3809section that describes the &lt;import&gt; element, it says:
3810</p><p>
3811After executing an import element, STAXResult will be set to a list
3812containing:
3813</p><div class="variablelist"><dl><dt><span class="term">STAXResult[0]</span></dt><dd>Either None or a list containing a STAXImportError object and a text
3814string with details about the error.</dd><dt><span class="term">STAXResult[1]</span></dt><dd>A list of the successfully imported functions that
3815  were requested to be imported.</dd><dt><span class="term">STAXResult[2]</span></dt><dd>A list of the successfully imported functions that were required
3816  by other functions.</dd><dt><span class="term">STAXResult[3]</span></dt><dd>A list of the functions that were requested to be imported but
3817  already existed (so they were not imported).</dd><dt><span class="term">STAXResult[4]</span></dt><dd>A list of the functions that were required by other functions but
3818  already existed (so they were not imported).</dd><dt><span class="term">STAXResult[5]</span></dt><dd>A list of the functions that were not requested to be imported and
3819  were not required by other functions.</dd><dt><span class="term">STAXResult[6]</span></dt><dd>A list of functions requested to be imported that were not found.
3820  </dd></dl></div><p>
3821Here are some STAX jobs that demonstrate this:
3822</p><div class="example"><a name="d0e2576"></a><p class="title"><b>Example&nbsp;15.&nbsp;D:/dev/src/stax/A.xml</b></p><pre class="programlisting">
3823&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
3824&lt;!DOCTYPE stax SYSTEM "stax.dtd"&gt;
3825
3826&lt;stax&gt;
3827
3828  &lt;defaultcall function="FunctionA"/&gt;
3829
3830  &lt;script&gt;
3831    machName = 'lucas'
3832  &lt;/script&gt;
3833
3834  &lt;function name="FunctionA"&gt;
3835    &lt;sequence&gt;
3836
3837      &lt;message&gt;'Running FunctionA'&lt;/message&gt;
3838
3839      &lt;import machine="machName" file="'D:/dev/src/stax/B.xml'" mode="'error'"/&gt;
3840
3841      &lt;message&gt;
3842        'After import B.xml:\n%s\n%s\n%s\n%s\n%s\n%s\n%s' % \
3843        (STAXResult[0], STAXResult[1], STAXResult[2], STAXResult[3],
3844         STAXResult[4], STAXResult[5], STAXResult[6])
3845      &lt;/message&gt;
3846
3847      &lt;call function="'FunctionB'"/&gt;
3848      &lt;call function="'FunctionB'"/&gt;
3849      &lt;call function="'FunctionB'"/&gt;
3850
3851    &lt;/sequence&gt;
3852  &lt;/function&gt;
3853
3854&lt;/stax&gt;
3855</pre></div><div class="example"><a name="d0e2581"></a><p class="title"><b>Example&nbsp;16.&nbsp;D:/dev/src/stax/B.xml</b></p><pre class="programlisting">
3856&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
3857&lt;!DOCTYPE stax SYSTEM "stax.dtd"&gt;
3858
3859&lt;stax&gt;
3860
3861  &lt;function name="FunctionB"&gt;
3862    &lt;sequence&gt;
3863
3864      &lt;message&gt;'Running FunctionB'&amp;lt;/message&gt;
3865
3866      &lt;import machine="machName" file="'D:/dev/src/stax/C.xml'" mode="'error'"/&gt;
3867
3868      &lt;message&gt;
3869        'After import C.xml:\n%s\n%s\n%s\n%s\n%s\n%s\n%s' % \
3870        (STAXResult[0], STAXResult[1], STAXResult[2], STAXResult[3],
3871         STAXResult[4], STAXResult[5], STAXResult[6])
3872      &lt;/message&gt;
3873
3874    &lt;/sequence&gt;
3875  &lt;/function&gt;
3876
3877&lt;/stax&gt;
3878</pre></div><div class="example"><a name="d0e2586"></a><p class="title"><b>Example&nbsp;17.&nbsp;D:/dev/src/stax/C.xml</b></p><pre class="programlisting">
3879&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
3880&lt;!DOCTYPE stax SYSTEM "stax.dtd"&gt;
3881&lt;stax&gt;
3882
3883  &lt;function name="FunctionC"&gt;
3884    &lt;sequence&gt;
3885
3886      &lt;message&gt;'Running FunctionC'&lt;/message&gt;
3887
3888    &lt;/sequence&gt;
3889  &lt;/function&gt;
3890
3891&lt;/stax&gt;
3892</pre></div><p>
3893Here are the results that were logged.  As you can see, the second and third
3894time that FunctionB was called, the STAXResult after importing C.xml in
3895FunctionB shows 'FunctionC' showing up in STAXResult[3] instead of
3896STAXResult[1].
3897</p><table class="simplelist" border="0" summary="Simple list"><tr><td>STAXResult[1] is a list of the successfully imported functions that
3898were requested to be imported.</td></tr><tr><td>STAXResult[3]: A list of the functions that were requested to be
3899imported but already existed (so they were not imported).</td></tr></table><pre class="screen">
3900<span><b class="command"><tt class="prompt">C:\&gt;</tt>staf local log query machine lucas logname STAX_Job_11_User</b></span>
3901Response
3902--------
390320030319-18:52:10|lucas|189|STAX/Job/11|Info|Running FunctionA
390420030319-18:52:11|lucas|189|STAX/Job/11|Info|After import B.xml:
3905None
3906['FunctionB']
3907[]
3908[]
3909[]
3910[]
3911[]
391220030319-18:52:11|lucas|189|STAX/Job/11|Info|Running FunctionB
391320030319-18:52:11|lucas|189|STAX/Job/11|Info|After import C.xml:
3914None
3915['FunctionC']
3916[]
3917[]
3918[]
3919[]
3920[]
392120030319-18:52:11|lucas|189|STAX/Job/11|Info|Running FunctionB
392220030319-18:52:11|lucas|189|STAX/Job/11|Info|After import C.xml:
3923None
3924[]
3925[]
3926['FunctionC']
3927[]
3928[]
3929[]
393020030319-18:52:11|lucas|189|STAX/Job/11|Info|Running FunctionB
393120030319-18:52:11|lucas|189|STAX/Job/11|Info|After import C.xml:
3932None
3933[]
3934[]
3935['FunctionC']
3936[]
3937[]
3938[]
3939</pre></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><a name="d0e2605"></a><h4 class="title"><a name="d0e2605"></a>4.3. STAX Monitor Questions</h4></td></tr><tr class="toc" colspan="2"><td align="left" valign="top" colspan="2"><dl><dt>4.3.1. <a href="#d0e2608">What does RC 2 mean when starting the STAX Job Monitor?</a></dt><dt>4.3.2. <a href="#d0e2616">What does RC 16 mean when starting the STAX Job Monitor?</a></dt><dt>4.3.3. <a href="#d0e2624">
3940What does RC 2 mean when submitting a new job via the STAX Job Monitor?
3941</a></dt><dt>4.3.4. <a href="#d0e2632">
3942What does RC 16 mean when submitting a new job via the STAX Job Monitor?
3943</a></dt><dt>4.3.5. <a href="#d0e2640">
3944Why I'm I getting a java.util.zip.ZipException running "java -jar STAXMon.jar"?
3945</a></dt><dt>4.3.6. <a href="#d0e2654">
3946Why doesn't the STAX Job Monitor window have a close confirmation?
3947</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2608"></a><a name="d0e2609"></a><b>4.3.1.</b></td><td align="left" valign="top"><p>What does RC 2 mean when starting the STAX Job Monitor?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3948When starting the STAX Job Monitor, if you get an error message "Error
3949registering Job Monitor. Could not register for Job Events RC = 2",
3950this means that Event service name specified in the STAX Job Monitor
3951Properties was not found on the specified Event machine.  In the main
3952STAX Job Monitor window, click on File in the Menu bar, and then select
3953Properties.  Make sure that the Event Service Name is the correct
3954Event service name for the specified Event machine.  Also make sure
3955that the Event service has been installed and configured on the Event service
3956machine.
3957</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2616"></a><a name="d0e2617"></a><b>4.3.2.</b></td><td align="left" valign="top"><p>What does RC 16 mean when starting the STAX Job Monitor?</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3958When starting the STAX Job Monitor, if you get an error message "Error
3959registering Job Monitor.  Could not register for Job Events RC = 16",
3960this means that Event service machine specified in the STAX Job
3961Monitor Properties was not found.  In the main STAX Job Monitor window,
3962click on File in the Menu bar, and then select Properties.  Make sure
3963that the Event Service Machine shown is the correct Event service machine.
3964</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2624"></a><a name="d0e2625"></a><b>4.3.3.</b></td><td align="left" valign="top"><p>
3965What does RC 2 mean when submitting a new job via the STAX Job Monitor?
3966</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3967When starting a new job through the STAX Job Monitor, if you get an
3968error message "STAX Error.  RC:2  Error starting Job Monitor
3969&lt;STAX service name&gt;", this means that STAX service name specified in
3970the STAX Job Monitor Properties was not found on the specified STAX service
3971machine.  The "&lt;STAX service name&gt;" in the error message is the
3972STAX service name which would not be found.  In the main STAX Job
3973Monitor window, click on File in the Menu bar, and then select Properties.
3974Make sure that the STAX Service Name is the correct STAX service name for
3975the specified STAX service machine.  Also make sure that the STAX
3976service has been installed and configured on the STAX service machine.
3977</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2632"></a><a name="d0e2633"></a><b>4.3.4.</b></td><td align="left" valign="top"><p>
3978What does RC 16 mean when submitting a new job via the STAX Job Monitor?
3979</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3980When starting a new job through the STAX Job Monitor, if you get an
3981error message "STAX Error.  RC:16  Error starting Job Monitor",
3982this means that STAX service machine specified in the STAX Job Monitor
3983Properties was not found.  In the main STAX Job Monitor window, click
3984on File in the Menu bar, and then select Properties.  Make sure that
3985the STAX Service Machine is the correct STAX service machine.
3986</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2640"></a><a name="d0e2641"></a><b>4.3.5.</b></td><td align="left" valign="top"><p>
3987Why I'm I getting a java.util.zip.ZipException running "java -jar STAXMon.jar"?
3988</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3989To run the command <span><b class="command">java -jar STAXMon.jar</b></span>,
3990the STAXMon.jar file must be in the current directory (otherwise you will
3991get the ZipException).  If it is not in the current directory, then you need
3992to fully qualify the jar file name:
3993<span><b class="command">java -jar c:/staf/services/stax/STAXMon.jar</b></span>
3994</p><p></p></td></tr><tr class="question"><td align="left" valign="top"><a name="d0e2654"></a><a name="d0e2655"></a><b>4.3.6.</b></td><td align="left" valign="top"><p>
3995Why doesn't the STAX Job Monitor window have a close confirmation?
3996</p></td></tr><tr class="answer"><td align="left" valign="top"><b></b></td><td align="left" valign="top"><p>
3997Closing the STAX Job Monitor window should never terminate your job.
3998Doing that just closes that view of the job; the STAX job should still
3999be running.  In the main STAX Monitor window (which shows the table
4000of currently running STAX jobs), your job still should be there, and you
4001should be able to right click on it and select "Start Monitoring", and
4002you should see a new STAX Job Monitor window for your STAX job.
4003</p><p></p></td></tr></tbody></table></div></div></body></html>