Yes you can pass arguments to STAX functions. It wasn't clear to me if
you were asking how to do this when calling a function within a STAX job
or if you were asking how to do pass arguments to a STAX job's starting
function when submitting it for execution via a STAX EXECUTE request.
You can pass arguments to a STAX job's starting function via the ARGS
option on a STAX EXECUTE request. Or, you can use the SCRIPT or
SCRIPTFILE option on a STAX EXECUTE request to use Python code to set
variables that can be accessed by your STAX job. For more information on
the options you can specify when submitting a STAX job via a STAX EXECUTE
request see the STAX User's Guide at
http://staf.sourceforge.net/current/STAX/staxug.html#Header_Execute.
Or, if you are reading from your.config file within the STAX job then you
could pass the variable values you obtain to any function when calling the
function.
See section "call: Call a Function" within the STAX User's Guide for more
information on calling a function with arguments (via a list, map, single
arg, etc) at
http://staf.sourceforge.net/current/STAX/staxug.html#Header_Call.
So, say you had a STAX function like the following that requires values to
be passed for argA and argB as a list.
<function name="startProcess">
<function-list-args>
<function-required-arg name="argA"/>
<function-required-arg name="argB"/>
<function-optional-arg name="argD" value="'xyz'"/>
</function-list-args>
<sequence>
<process>
<location>'local'</location>
<command mode="'shell'">'Run.exe -A=%s -B=%s -C -D=%s -E' % (argA,
argB, argD')</command>
</process>
<log message="1">'Process RC: %s, STAFResult: %s, STAXResult: %s' %
(RC, STAFResult, STAXResult)</log>
</sequence>
</function>
Within the STAX job you could call it as follows:
<script>
argA = 'abc'
argB = 'bcd'
</script>
<call function="'startProcess'">[argA, argB]</call>
Or, if this was the starting function for the STAX job you could pass
values for argA and argB when submitting the STAX job. For example:
STAF staxMachine STAX EXECUTE FILE /stax/job1.xml FUNCTION "startProcess"
ARGS "['abc', 'bcd']"
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Prasant Biswal <prasantkubis...@gmail.com>
To: staf-users@lists.sourceforge.net
Date: 08/04/2011 09:18 AM
Subject: [staf-users] How to call function with different arguments
Dear Stafusers
Can you please help with below problems:
1.Can it possible to run an exe with multiple variable (some variables
will not change and some i need to read from a config file )
For example :Suppose i need to run the Run.exe using a multiple arguments:
Run.exe -A=abc -B=bcd -C -D=xyz -E
In this -C , -E will be kept constant (no changes) and -A and -B will be
read from config file and pass during calling the function.
Please let me know if it is possible using STAX.
Thanks,
Prasant
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users