Error with DSRoutine

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
jokerday
Participant
Posts: 4
Joined: Thu Jun 02, 2011 4:14 am

Error with DSRoutine

Post 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.
rschirm
Premium Member
Premium Member
Posts: 27
Joined: Fri Dec 13, 2002 2:53 pm

Post by rschirm »

Please provide a detailed example of what you should be seeing and what you are seeing.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, simply saying the data "is not what I want" doesn't really help us help you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
jokerday
Participant
Posts: 4
Joined: Thu Jun 02, 2011 4:14 am

Post 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:
jokerday
Participant
Posts: 4
Joined: Thu Jun 02, 2011 4:14 am

Post 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:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
jokerday
Participant
Posts: 4
Joined: Thu Jun 02, 2011 4:14 am

Post 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:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK... what happens when you change the code as I mentioned?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply