Hi,
I try to figure out how to get the correct return code from the DSExecute("UNIX",command,output,returncode). Our command is a unix shell script which implements a validation and load logic. Is the returncode the $? which is the return code of last unix code in the shell script or something else? Anyway please help.
Thanks.
Kevin
The ReturnCode of Unix Shell Script
Moderators: chulett, rschirm, roy
I can't say for sure and this may depend on what shell you are using. For us using Korn, my understanding is that the script returns the code from the last command the script executes. Classic problem is to get an error and 'echo' something about it before exiting the script - what you get is the status of the echo command which more than likely executed with no error. You can override that by using an explicit 'return' statement in the script, which sounds more like what you might want to do.
-craig
-craig
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
True provided rsh succeeds (!).
If you don't need any of the other output, you can echo the value of $? and capture this through the third argument of DSExecute(). For example:
command = "rsh ":db2Host:" -f ":KornScripts: "; echo $?"
Probably even better would have the script generate something (a file?) whose existence, if not contents, could be checked.
If you don't need any of the other output, you can echo the value of $? and capture this through the third argument of DSExecute(). For example:
command = "rsh ":db2Host:" -f ":KornScripts: "; echo $?"
Probably even better would have the script generate something (a file?) whose existence, if not contents, could be checked.