Page 1 of 1

DSExecute return code

Posted: Wed May 07, 2008 10:06 am
by shrey3a
Hi Gurus,

I'm trying to create a server routine in 8.0 with below code.

cmd = "cd /opt/isproj/ctl/ ./ctlAccess 2"
Call DSExecute("UNIX",cmd,Output,SystemReturnCode)
Ans = Output

But I get no output , but return code is 0 which is sure that its getting executing

ctlAccess is a program on DataStage box its a compiled c program which gives the return value on passing of argument i.e. 2 will return MRD

If I go to command line on ds box and browse to directory
cd /opt/isproj/ctl/ and run the command ./ctlAccess 2 it returns MRD but not from DSExecute I'm able to catch the output.

Regards,

Posted: Wed May 07, 2008 10:19 am
by chulett
You need a command delimiter between the two, otherwise all that happens in the 'cd' I'd wager. While you could use ";" I'd suggest the much nicer "&&" which tells the second command to execute only if the first is successful:

Code: Select all

cmd = "cd /opt/isproj/ctl/ && ./ctlAccess 2" 
Call DSExecute("UNIX",cmd,Output,SystemReturnCode) 
Ans = Output 

Posted: Wed May 07, 2008 1:06 pm
by shrey3a
Thanks a lot it worked.

Regards,

[quote="chulett"]You need a command delimiter between the two, otherwise all that happens in the 'cd' I'd wager. While you could use ";" I'd suggest the much nicer "&&" which tells the second command to execute only if the first is successful:

[code]cmd = "cd /opt/isproj/ctl/ && ./ctlAccess 2"
Call DSExecute("UNIX",cmd,Output,SystemReturnCode)
Ans = Output [/code][/quote]