Passing Argument to Specific Function in STAX Job Using Command Line

372 Views Asked by At

I have a STAX Job new15.xml inside /home/dharm/staf/services/stax/samples location. new15.xml have two function main and readFile

 file_name = '/home/dharm/datafiles/ReadData3.txt'

Required Argument for readFile is file_name.

I want to execute this command using command line but i also want to give required parameter to readFile function.

staf local execute file /home/dharm/staf/services/stax/samples/new15.xml wait return result

What are the modification i should do in command to make it work.

"What I have Trierd"

FIRST

dharm@ubuntu:~$ staf local stax execute file /home/dharm/staf/services/stax/samples/new15.xml ARGS file_name="'/home/dharm/datafiles/ReadData3.txt'" wait returnresult
Response
--------
{
  Job ID         : 3
  Start Date-Time: 20130418-23:54:39
  End Date-Time  : 20130418-23:54:40
  Status         : Terminated
  Result         : None
  Job Log Errors : [
    {
      Date-Time: 20130418-23:54:40
      Level    : Error
      Message  : STAXPythonEvaluationError signal raised. Terminating job. 

===== XML Information =====

File: /home/dharm/staf/services/stax/samples/new15.xml, Machine: local://local
Line <Error in ARGS option>: Error in element type "<External>".

===== Python Error Information =====

com.ibm.staf.service.stax.STAXPythonEvaluationException: 

Python object evaluation failed for:
file_name='/home/dharm/datafiles/ReadData3.txt'

SyntaxError: ("mismatched input '=' expecting EOF", ('<pyEval string>', 1, 9, "file_name='/home/dharm/datafiles/ReadData3.txt'\n"))

===== Call Stack for STAX Thread 1 =====

[]
    }
  ]
  Testcase Totals: {
    Tests : 0
    Passes: 0
    Fails : 0
  }
}

"2ND Command"

dharm@ubuntu:~$ staf local stax execute file /home/dharm/staf/services/stax/samples/new15.xml SCRIPT file_name="'/home/dharm/datafiles/ReadData3.txt'" wait returnresult
Response
--------
{
  Job ID         : 4
  Start Date-Time: 20130418-23:56:01
  End Date-Time  : 20130418-23:56:02
  Status         : Terminated
  Result         : None
  Job Log Errors : [
    {
      Date-Time: 20130418-23:56:02
      Level    : Error
      Message  : STAXFunctionArgValidate signal raised. Terminating job. 

===== XML Information =====

File: /home/dharm/staf/services/stax/samples/new15.xml, Machine: local://local
Line 20: Error in element type "call".

Required argument "file_name" is not provided in the call to function "readFile".

===== Call Stack for STAX Thread 1 =====

[
  function: main (Line: 19, File: /home/dharm/staf/services/stax/samples/new15.xml, Machine: local://local)
]
    }
  ]
  Testcase Totals: {
    Tests : 0
    Passes: 0
    Fails : 0
  }
}
0

There are 0 best solutions below