Page 1 of 1

Error with DSRoutine

Posted: Thu Jun 02, 2011 4:18 am
by jokerday
I wrote a simple DSRoutine, which will invoke my external application (*.exe) and produce a result on the command prompt.

Sample Code:-

Code: Select all

Command = DQuote('C:\Abc\exec.bat ' : InputData) 
Call DSExecute("NT", Command, Output, ErrCode)
Ans = Output
When I test this function alone, it returns me the correct data. Unforunately, when I used this routine in a Transformer and write to a file, the data is not what I want. I am not sure if this is due to the NLS settings, and appreciate any feedback.

Thanks.

Posted: Thu Jun 02, 2011 7:33 am
by rschirm
Please provide a detailed example of what you should be seeing and what you are seeing.

Posted: Thu Jun 02, 2011 7:37 am
by chulett
As noted, simply saying the data "is not what I want" doesn't really help us help you.

Posted: Thu Jun 02, 2011 7:18 pm
by jokerday
please take a look with the example below :-

Data returned from Routine Test:
P91300000022

Data returned from workflow (write to a file from transformer stage):
K000

Hence, other than NLS settings, couldn't think of any possible reason. :oops:

Posted: Thu Jun 02, 2011 7:38 pm
by jokerday
please take a look with the example below :-

Data returned from Routine Test:
P91300000022

Data returned from workflow (write to a file from transformer stage):
K000

Hence, other than NLS settings, couldn't think of any possible reason. :oops:

Posted: Thu Jun 02, 2011 7:43 pm
by chulett
Without knowing what your batch file is doing, still hard to offer much cogent advice. However... add a check of the error code and call DSLogInfo() in the routine to log what comes back.

You'll also need to pick up on the fact that, as gets mentioned here over and over, output from DSExecute can be multiple 'records' and so are returned in a dynamic array. I'm assuming the 'square box' is the Field Mark that is used to delimit the array elements. If you know it will 'only ever return one record', only return the first element in the Answer:

Code: Select all

Command = DQuote('C:\Abc\exec.bat ' : InputData) 
Call DSExecute("NT", Command, Output, ErrCode) 
Ans = Output<1>
Perhaps between those two things we can get an idea about what is going on. We may need you to post the exec batch file to see if that sheds any light on the issue.

Posted: Thu Jun 02, 2011 8:20 pm
by jokerday
the batch file is actually invoking an exe application. The program is written in C language, and it shall return only one line. I tested it externally and it is working fine and same goes to the DSRoutine test, just when I put everything into the workflow, the output file behaves unexpectedly.

I tried the ways below :-
my error code is actually 0, and there is no second output here. :roll:

Posted: Thu Jun 02, 2011 9:21 pm
by chulett
OK... what happens when you change the code as I mentioned?