The STAX service provides every STAX job its own unique STAF handle.  So, 
generally speaking, a STAX job does not have to do anything to have a STAF 
handle available.  This handle is used by the <process> and <stafcmd> 
elements to submit requests.  This handle is used across all threads in a 
STAX job. 

So, it seems like you would want to do the following

<stafcmd>
  <location>'local'</location>
  <service>'var'</service>
  <request>'set var <name>=<value>'</request>
</stafcmd

That will set <name> equal to <value> in that handle associated with your 
STAX job.  Those variables will be used in all subsequent requests 
generated by your job, including all <process> and <stafcmd> elements.

Charles Rankin




"Ahmed Mostafa" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
05/11/2008 02:30 AM

To
STAF <[email protected]>
cc
David Bender/Austin/[EMAIL PROTECTED]
Subject
Re: [staf-users] Share variables across commands






Let me state my requirements more clearly, I wrote a STAX job that submits 
requests to a remote machine, I need subsequent process and stafcmd 
elements to use the same handle within a thread.

It is stated here that:
The first thing a process should do is register with STAF to obtain a 
handle.
So how can I perform this registration without using the STAFHandle class?

For static handles, it is stated here in the STAF user's guide that:
This command is only valid if submitted to the local machine, not to 
remote machines.
So static handles can be created for local machine only, while I need this 
for a remote machine.

Thanks

2008/5/7 David Bender <[EMAIL PROTECTED]>:

Then you probably just want to first resolve the PROCESS START COMMAND 
string, specifying the HANDLE <Handle> on the VAR RESOLVE request.  Then 
use the result string as the COMMAND you are submitting to the remote 
machine. 

Or you can use a static handle for both the VAR SET and the PROCESS 
START... 

David Bender
STAF/STAX Development
8-1268 (512-838-1268) 
IBM Austin Bldg. 903-5B002
Internet: [EMAIL PROTECTED]



"Ahmed Mostafa" <[EMAIL PROTECTED]> 
05/07/2008 12:43 PM 


To
STAF <[email protected]> 
cc
David Bender/Austin/[EMAIL PROTECTED] 
Subject
Re: [staf-users] Share variables across commands








That's exactly what I'm trying to do: use variables for the calling handle 
only (not shared or system variables), but the code you provided doesn't 
work, it gives: 
Variable resolution failed for string: echo {First} {Second} {Third} 
You are trying to resolve a variable that does not exist. 
That's what I expected as the VAR Set command has a handle and the PROCESS 
Start command has another one, so those variables aren't visible to it.

2008/5/7 David Bender <[EMAIL PROTECTED]>: 

It depends on exactly what you are trying to do.  You can certainly use 
VAR SET to remotely set variables (maybe you can point me to the STAF 
documentation where that is not clear). 

For example, I can set some variables on a remote system: 

$ STAF remotemachine.company.com VAR SET VAR first=1st VAR second=2nd VAR 
third=3rd 

Response 
-------- 

And then run some STAF requests to the remote machine which reference 
those variables: 

$ STAF remotemachine.company.com PROCESS START SHELL COMMAND "echo {first} 
{second} {third}" RETURNSTDOUT STDERRTOSTDOUT WAIT 
Response 
-------- 
{ 
 Return Code: 0 
 Key        : <None> 
 Files      : [ 
   { 
     Return Code: 0 
     Data       : 1st 2nd 3rd 

   } 
 ] 
} 

$ STAF remotemachine.company.com PROCESS START SHELL COMMAND "echo {first} 
{second} {third}" RETURNSTDOUT STDERRTOSTDOUT WAIT 
Response 
-------- 
{ 
 Return Code: 0 
 Key        : <None> 
 Files      : [ 
   { 
     Return Code: 0 
     Data       : 1st 2nd 3rd 

   } 
 ] 
} 

David Bender
STAF/STAX Development
8-1268 (512-838-1268) 
IBM Austin Bldg. 903-5B002
Internet: [EMAIL PROTECTED]


"Ahmed Mostafa" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED] 
05/07/2008 01:39 AM 


To
STAF <[email protected]> 
cc

Subject
[staf-users] Share variables across commands










Hello,

I want to share some variables across some successive staf commands on a 
remote machine, do I have to register a static handle? (it is stated that 
the VAR Set command is not available for remote machine!). So how can I do 
this?

Thanks
-- 
Ahmed Mostafa
0123919750
[EMAIL PROTECTED] 

Software Developer
IBM Egypt, Cairo Technology Development Center 
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________

staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users




-- 
Ahmed Mostafa
0123919750
[EMAIL PROTECTED]
Software Developer
IBM Egypt, Cairo Technology Development Center 



-- 
Ahmed Mostafa
0123919750
[EMAIL PROTECTED]
Software Developer
IBM Egypt, Cairo Technology Development Center 
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to