shell script for dsjob command

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
attu
Participant
Posts: 225
Joined: Sat Oct 23, 2004 8:45 pm
Location: Texas

shell script for dsjob command

Post by attu »

kinda new to shell script and trying to run the following dsjob command from the script..and get jobnames of my project

the error i get is
script.sh[2]: devtest: not found
Invalid arguments: dsjob -ljobs <project>

Status code = -9999 DSJE_DSJOB_ERROR



**************************************************
#!/usr/bin/ksh
project= devtest
export project

DSBIN=`cat /.dshome`/bin
export DSBIN

cd `cat /.dshome`
. ./dsenv

DSCMDEXE="$DSBIN/dsjob"
export DSCMDEXE

cmdstring=`$DSCMDEXE -ljobs $project`
export cmdstring

echo "$cmdstring"



******************************************

Thanks.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

script.sh[2]: devtest: not found

means line #2 has an error (probably the space after the = sign)

Also consider using explicit hostname, userid, and password notation with dsjob.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
attu
Participant
Posts: 225
Joined: Sat Oct 23, 2004 8:45 pm
Location: Texas

Post by attu »

kcbland wrote:script.sh[2]: devtest: not found

means line #2 has an error (probably the space after the = sign)

Also consider using explicit hostname, userid, and password notation with dsjob.
Yup , it worked, but i didnt use the hostname, userid or password. BTW what would the syntax be

dsjob -ljobs hostname userid pswd project

thanks for notifying the error..
attu
Participant
Posts: 225
Joined: Sat Oct 23, 2004 8:45 pm
Location: Texas

Post by attu »

When I am trying to get the parametrs for my job froma project the script is not giving the required output.

***************************************

#!/usr/bin/ksh

project=devtest
export project

jobname=test1
export jobname

DSBIN=`cat /.dshome`/bin
export DSBIN

cd `cat /.dshome`
. ./dsenv

DSCMDEXE="$DSBIN/dsjob"
export DSCMDEXE

cmdstring='$DSCMDEXE -lparams $project $jobname'
export cmdstring

echo "$cmdstring"

***********************************

the output is $DSCMDEXE -lparams $project $jobname

Any suggestions please?

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Because you are exporting the final 'command string' not actually executing it.

Change:

Code: Select all

export cmdstring
To:

Code: Select all

eval ${cmdstring}
and see if that works more better.
-craig

"You can never have too many knives" -- Logan Nine Fingers
attu
Participant
Posts: 225
Joined: Sat Oct 23, 2004 8:45 pm
Location: Texas

Post by attu »

chulett wrote:Because you are exporting the final 'command string' not actually executing it.

Change:

Code: Select all

export cmdstring
To:

Code: Select all

eval ${cmdstring}
and see if that works more better.
Thanks Chulett, it worked.
Post Reply