Page 1 of 1

ExecSH

Posted: Wed Apr 21, 2004 9:03 am
by Mark j
Hi

I am trying to use ExecSH in before job subroutine where i am calling a shell script which performs deletion of a million rows in a table x . When i was trying to execute the shell from datastage using ExecSH i am getting following error....... but shellscript works fine when i run from cmd line...
what might be the reasons for the error

jobtest1..BeforeJob (ExecSH): Error when executing command: "/Project/Source/xxx.ksh"
*** Output from command was: ***
DB="db2"
+ DB=db2
USERID="cooo"
+ USERID=cooo
PASSWD="xxx"
+ PASSWD=xxx

db2 "connect to $DB user $USERID using $PASSWD"
+ db2 connect to dedw1d user edwd using twins
SQL10007N Message "-5005" could not be retrieved. Reason code: "2".
if [ $? -ne 0 ]; then
echo "Unable to Connect to database $DB"
exit 1
fi
+ [ 8 -ne 0 ]
+ echo Unable to Connect to database dedw1d
Unable to Connect to database dedw1d
+ exit 1

Job stopped - before-job routine returned error: Error 1 returned from BEFORE routine DSU.ExecSH

Posted: Wed Apr 21, 2004 9:14 am
by roy
Hi & welcome aboard,
Some times the parameters passed from DS to scripts or what ever get messed up, especially when you need the whole string to contain qoutes.
this can be resoled in manipulation on the actual string you run (search this forum it was discused).

another way might be to use a user defined query using the gui stages, where you can also use parameters.

IHTH,

Posted: Wed Apr 21, 2004 9:14 am
by kcbland
DS runs under the engines environment, not the user running the job. Testing a script from the command line is comparing apples to toaster ovens. You must look at the environment your jobs execute under and make sure all variables and paths are appropriate.

Posted: Wed Apr 21, 2004 9:22 am
by Mark j
Thanks guys for your replies... yeah i did check the path ... but as roy was saying i tried using the path as a string and it is working....



Thanks again
Mark