Page 1 of 1

Run Datastage Job from Unix Shell Script

Posted: Wed Jun 27, 2012 4:14 am
by sjordery
Hi All,

I have a Unix script which calls a data stage job.
While executing the script from Datastage 7.5 server it runs fine. But the same script while executing from V8 server it's giving error " bash: dsjob: command not found " . Any help would be appreciated.



Below is the script
----------------------

dshome=`cat /.dshome`;export dshome
PATH=$PATH:$dshome/lib; export PATH
. $dshome/dsenv

PROJECT=P_Dev
JOB=test_job

RunInfo=`dsjob -run -jobstatus $PROJECT $JOB 2>&1`
echo $RunInfo



Thanks,
sjordery

Posted: Wed Jun 27, 2012 5:03 am
by vamsi.4a6
1) cd $DSHome/bin

PROJECT=P_Dev
JOB=test_job

RunInfo=`dsjob -run -jobstatus $PROJECT $JOB 2>&1`
echo $RunInfo

Now try it I hope the above code will work

Posted: Wed Jun 27, 2012 5:41 am
by sjordery
Hi Vamsi,

Sorry, it didn't work. I am getting the same error.

I tried with this:

cd $DSHome/bin

PROJECT=P_Dev
JOB=test_job

RunInfo=`dsjob -run -jobstatus $PROJECT $JOB 2>&1`
echo $RunInfo


Thanks,
Sjordery.

Posted: Wed Jun 27, 2012 6:54 am
by chulett
This is bog standard command line stuff and I'm sure an exact search here for "command not found" will turn up all of the lectures on the subject. It's a pity that people nowadays are so entrenched in a GUI mouse-driven world that simple stuff like this trips them up. Makes old farts like me sad. :(

UNIX is a little pickier about how it finds commands than DOS is. You always need to tell it where your command lives. You do this using three different mechanisms:

1) You include the directory where it lives in your $PATH environment variable, then it can find it 'automatically'.
2) Use a relative path to tell it where it lives. This means the path is relative to where you are and starts with a dot which stands for your "current directory".
3) Use a full path to tell it where it lives. This means it doesn't matter where you are, just it, and the path starts with a forward slash i.e. "from root".

An example of #2 from the bin directory: RunInfo=`./dsjob xxxx
An example of #2 from $DSHome: RunInfo=`./bin/dsjob xxxx

An example of #3: RunInfo=`/etl/DataStage/DSEngine/bin/dsjob xxxx

NOTE: completely made up full path shown as an example only, if you want to see what yours is do the same thing your script is doing:

Code: Select all

cat /.dshome

Posted: Wed Jun 27, 2012 8:48 am
by jwiles
Just to clear up a question or two that came to my mind:

1) Are the IS tiers installed on a single server or on separate servers?
2) If on separate servers, which one are you running the script on?

Regards,

Posted: Wed Jun 27, 2012 10:50 am
by sjordery
Thanks Chullet, Below one worked.

------------------------------------------------

dshome=`cat /.dshome`;export dshome
PATH=$PATH:$dshome/lib; export PATH
. $dshome/dsenv

PROJECT=P_Dev
JOB=test_job

RunInfo=`/opt/IBM/InformationServer/Server/DSEngine/bin/dsjob -run -jobstatus $PROJECT $JOB 2>&1`
echo $RunInfo

--------------------------------------------------

Regards,
Sjordery.

Posted: Wed Jun 27, 2012 3:12 pm
by rameshrr3
can you add

Code: Select all

$DSHOME/bin
to your path env variable ?

The library path env variable ( Depending on your Unix 'flavor' ) SHLIB_PATH or LD_LIBRARY_PATH should include your

Code: Select all

$DSHOME/lib
It seems your lib folder is in the path , which is not recommended

From the datastage install guide

Code: Select all

Platform Environment Variable
Solaris LD_LIBRARY_PATH
HP-UX SHLIB_PATH
HP_UX Itanium LD_LIBRARY_PATH
AIX LIBPATH
Compaq Tru64 LD_LIBRARY_PATH
LINUX LD_LIBRARY_PATH