DSExecute return code

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

DSExecute return code

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

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

"You can never have too many knives" -- Logan Nine Fingers
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post 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]
Post Reply