Page 1 of 1

Running DS Job from Unix command line

Posted: Mon Mar 22, 2010 1:11 pm
by laiko
I have entered the following in unix command line:

Code: Select all

/DS/Ascential/DataStage/DSEngine/bin/dsjob -run -jobstatus -wait -mode NORMAL -param JOB_ID=98246 PREVRUNDT="2010-03-20 18:00:00" CURRRUNDT="2010-03-21 18:00:00" -warn 50 APPPRJ Load_Target
It errored out with the following message:

Code: Select all

Invalid arguments: dsjob -run
                        [-mode <NORMAL | RESET | VALIDATE>]
                        [-param <name>=<value>]
                        [-warn <n>]
                        [-rows <n>]
                        [-wait]
                        [-opmetadata <TRUE | FALSE>]
                        [-disableprjhandler]
                        [-disablejobhandler]
                        [-jobstatus]
                        [-userstatus]
                        [-local]
                        [-useid]
                        <project> <job|jobid>
What can be wrong here???

Posted: Mon Mar 22, 2010 1:18 pm
by asorrell
Try putting -param in front of each parameter.

I can't access a system right now to test, but that may fix it.

Posted: Mon Mar 22, 2010 1:27 pm
by ray.wurlod
What Andy means is

Code: Select all

/DS/Ascential/DataStage/DSEngine/bin/dsjob -run -jobstatus -wait -mode NORMAL -param JOB_ID=98246 PREVRUNDT="2010-03-20 18:00:00"-param CURRRUNDT="2010-03-21 18:00:00" -warn 50 APPPRJ Load_Target
Note the extra "-param" ahead of CURRRUNDT.

Posted: Tue Mar 23, 2010 10:57 am
by asorrell

Code: Select all

/DS/Ascential/DataStage/DSEngine/bin/dsjob -run -jobstatus -wait -mode NORMAL -param JOB_ID=98246 -param PREVRUNDT="2010-03-20 18:00:00"-param CURRRUNDT="2010-03-21 18:00:00" -warn 50 APPPRJ Load_Target
Should be another one in front of PREVRUNDT as well...

Let us know if that fixes it.

Posted: Tue Mar 23, 2010 11:17 am
by laiko
Yes, that worked by adding -param before each parameter. Thank you.

I am going to put this code in a shell script. I have something like

Code: Select all

DSPath="/DS/Ascential/DataStage/DSEngine/bin"

paramvals="param JOB_ID=98246 -param PREVRUNDT='2010-03-20 18:00:00' -param CURRRUNDT='2010-03-21 18:00:00'"

conn="$DSPath/dsjob"
paramlist=" -run -jobstatus -wait -mode NORMAL $paramvals -warn 50 "
jobinfo=" APPPRJ Load_Target"

$conn $paramlist $jobinfo
This does not work and says:

Code: Select all

Invalid arguments: dsjob -run
                        [-mode <NORMAL | RESET | VALIDATE>]
                        [-param <name>=<value>]
                        [-warn <n>]
                        [-rows <n>]
                        [-wait]
                        [-opmetadata <TRUE | FALSE>]
                        [-disableprjhandler]
                        [-disablejobhandler]
                        [-jobstatus]
                        [-userstatus]
                        [-local]
                        [-useid]
                        <project> <job|jobid>
But it works if I have:

Code: Select all

DSPath="/DS/Ascential/DataStage/DSEngine/bin"

conn="$DSPath/dsjob"
jobinfo=" APPPRJ Load_Target"

$conn -run -jobstatus -wait -mode NORMAL param JOB_ID=98246 -param PREVRUNDT='2010-03-20 18:00:00' -param CURRRUNDT='2010-03-21 18:00:00' -warn 50 $jobinfo
The list of parameters are dynamic so I'd like to put them in a string for readability of the code. I am really puzzled why it is not running when I am using variables.

Posted: Tue Mar 23, 2010 11:56 am
by asorrell
It fails because UNIX treats the "special" characters like the $ sign differently because of the quotes around it. Try using echo on the variables to see what Unix is actually submitting and you will probably see some differences from what you expect in terms of the finished command.

You'll need to play around a bit to get the quotes correct if you use environment variables to store the various pieces.

Posted: Tue Mar 23, 2010 11:57 am
by anbu

Code: Select all

paramvals="-param JOB_ID=98246 -param PREVRUNDT='2010-03-20 18:00:00' -param CURRRUNDT='2010-03-21 18:00:00'" 
Add dash before first param

Posted: Tue Mar 23, 2010 1:12 pm
by asorrell
Good catch on the typo! I need to get my contacts prescription updated.

Posted: Tue Mar 23, 2010 1:32 pm
by laiko
My bad... that's really a typo when I posted the question. But in the actual case, it really has a dash. So this does not work either:

Code: Select all

DSPath="/DS/Ascential/DataStage/DSEngine/bin" 

paramvals="-param JOB_ID=98246 -param PREVRUNDT='2010-03-20 18:00:00' -param CURRRUNDT='2010-03-21 18:00:00'" 

conn="$DSPath/dsjob" 
paramlist=" -run -jobstatus -wait -mode NORMAL $paramvals -warn 50 " 
jobinfo=" APPPRJ Load_Target" 

$conn $paramlist $jobinfo

Posted: Tue Mar 23, 2010 1:56 pm
by anbu
Add set -vx and show the trace of your script

Posted: Tue Mar 23, 2010 1:58 pm
by DSguru2B
Try the following

Code: Select all

DSPath="/DS/Ascential/DataStage/DSEngine/bin" 

paramvals="-param JOB_ID=98246 -param 'PREVRUNDT=2010-03-20 18:00:00' -param 'CURRRUNDT=2010-03-21 18:00:00'" 

conn="$DSPath/dsjob" 
paramlist=" -run -jobstatus -wait -mode NORMAL $paramvals -warn 50 " 
jobinfo=" APPPRJ Load_Target" 

eval $conn $paramlist $jobinfo