Run Datastage Job from Unix Shell Script

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
sjordery
Premium Member
Premium Member
Posts: 202
Joined: Thu Jun 08, 2006 5:58 am

Run Datastage Job from Unix Shell Script

Post 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
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Post 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
sjordery
Premium Member
Premium Member
Posts: 202
Joined: Thu Jun 08, 2006 5:58 am

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

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

"You can never have too many knives" -- Logan Nine Fingers
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post 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,
- james wiles


All generalizations are false, including this one - Mark Twain.
sjordery
Premium Member
Premium Member
Posts: 202
Joined: Thu Jun 08, 2006 5:58 am

Post 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.
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

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