dsjob -run cmd won't work some times

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
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

dsjob -run cmd won't work some times

Post by arsheshadri »

Hi ,

I am executing dsjob command from shell script.
I am reading the parameters from a text file which is in format PARAM1=VALUE
PARAM2=VALUE listed one below the other.

In my shell script the final command looks something like dsjob -run -jobstatus -param 'PARAM1=VALUE' -param 'PARAM2=VALUE' PROJECT1 JOB1

If I copy the above dsjob cmd and execute it from the prompt, it is working fine
But if I run this from the script, I am getting below error.

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>

Status code = -9999 DSJE_DSJOB_ERROR


Please let me know what might be the problem in my script.

Thanks & Regards
Sheshadri
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Re: dsjob -run cmd won't work some times

Post by DSguru2B »

arsheshadri wrote:Hi ,

dsjob -run -jobstatus -param 'PARAM1=VALUE' -param 'PARAM2=VALUE' PROJECT1 JOB1
Remove the quotes around 'PARAM1=VALUE'.
In other words, your dsjob command should now look like this

Code: Select all

dsjob -run -jobstatus -param PARAM1=VALUE -param PARAM2=VALUE PROJECT1 JOB1
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

Re: dsjob -run cmd won't work some times

Post by arsheshadri »

I tried without quotes..but still I am getting the error. Now I am not able to run this on cmd prompt. Earlier with quotes, I was atleast able to run this from command prompt.

Please look at the actual cmd.

dsjob -run -jobstatus -wait -param Source_File_LC=Client 58330013 Before CISROUTA -param Format=1407D -param Source_File_CISUAPT=Client 58330013 Before CISROUTA_1407D_lc -param Source_File_CISVALID=Client 58330013 Before CISROUTA_1407D_lc_1 -param Source_File_NA_Formatting=Client 58330013 Before CISROUTA_1407D_lc_1_2 -param EFX_HOME=/temp/DataStage/comm_insight/test -param LC_JOB_DIR=lenchecked -param CISUAPT_JOB_DIR=processed_1 -param CISVALID_JOB_DIR=processed_2 -param NAF_JOB_DIR=processed_3 Comm_INSIGHT_proj CI_JS2
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I see you have param values with spaces in them. You need to enclose only the value in double quotes. That will work. Basically your command should look like this now.

Code: Select all

dsjob -run -jobstatus -param PARAM1="VALUE" -param PARAM2="VALUE" PROJECT1 JOB1
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

Post by arsheshadri »

[quote="DSguru2B"]I see you have param values with spaces in them. You need to enclose only the value in double quotes. That will work. Basically your command should look like this now.

[code]
dsjob -run -jobstatus -param PARAM1="VALUE" -param PARAM2="VALUE" PROJECT1 JOB1[/code][/quote]

Still not working :? I added the " " around the parameter value.
Command looks like this.
----------------------------------------------------------------------------------
dsjob -run -jobstatus -wait -param Source_File_LC="Client 58330013 Before CISROUTA" -param Format="1407D" -param Source_File_CISUAPT="Client 58330013 Before CISROUTA_1407D_lc" -param Source_File_CISVALID="Client 58330013 Before CISROUTA_1407D_lc_1" -param Source_File_NA_Formatting="Client 58330013 Before CISROUTA_1407D_lc_1_2" -param EFX_HOME="/temp/DataStage/comm_insight/test" -param LC_JOB_DIR="lenchecked" -param CISUAPT_JOB_DIR="processed_1" -param CISVALID_JOB_DIR="processed_2" -param NAF_JOB_DIR="processed_3" Comm_INSIGHT_proj CI_JS2
------------------------------------------------------------------------------------
The same command is working from the unix prompt. :o
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Make sure they have been defined as "String" in the job properties.
I would need to take a look at your script, if you dont mind. There must be something you are doing there.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

Post by arsheshadri »

This is the code that I have written in the script.
-------------------------------------------------------------------------------
#Preparing the dsjob cmd by reading parameter file

cat $JOB_PARAM_DEST/$JOB_PARAM_FILE|
while read ParmValue
do
ParmList="$ParmList -param $ParmValue"
done

#Final dsjob cmd
cmd="dsjob -run -jobstatus $ParmList $PROJECT $DSJOB"

#executing the command
./cmd
return #?
#End of Script
-------------------------------------------------------------------------------
Parameter file looks like this
-------------------------------------------------------------------------------
Format="1407D"
Source_File_CISUAPT="Client 58330013 Before CISROUTA_1407D_lc"
Source_File_CISVALID="Client 58330013 Before CISROUTA_1407D_lc_1"
Source_File_NA_Formatting="Client 58330013 Before CISROUTA_1407D_lc_1_2"
EFX_HOME="/temp/DataStage/comm_insight/test"
LC_JOB_DIR="lenchecked"
CISUAPT_JOB_DIR="processed_1"
CISVALID_JOB_DIR="processed_2"
NAF_JOB_DIR="processed_3"
-------------------------------------------------------------------------------

Regards
Sheshadri
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I would hate to break it to you but when you pass parameter values like the way you are doing, they should not have any spaces in them. Once upon a time i spent way to many hours trying to figure it out.
Just for your own satisfaction, dont change anything in the script, just remove spaces from the param values in your param file, you will see that it will work like a charm.
Also try this, in your cmd variable put the actual values with spaces and with quotes. Like this

Code: Select all

cmd="dsjob -run -jobstatus -param Source_File_LC="Client 58330013 Before CISROUTA" -param Format="1407D" -param Source_File_CISUAPT="Client 58330013 Before CISROUTA_1407D_lc" -param Source_File_CISVALID="Client 58330013 Before CISROUTA_1407D_lc_1" -param Source_File_NA_Formatting="Client 58330013 Before CISROUTA_1407D_lc_1_2" -param EFX_HOME="/temp/DataStage/comm_insight/test" -param LC_JOB_DIR="lenchecked" -param CISUAPT_JOB_DIR="processed_1" -param CISVALID_JOB_DIR="processed_2" -param NAF_JOB_DIR="processed_3" $PROJECT $DSJOB"
And you will see that it will work.
Its just when passing the parameters via variable it doesnt like spaces.
Last edited by DSguru2B on Tue Jun 20, 2006 1:58 pm, edited 1 time in total.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Ultramundane
Participant
Posts: 407
Joined: Mon Jun 27, 2005 8:54 am
Location: Walker, Michigan
Contact:

Post by Ultramundane »

Have you tried to execute using eval? Make sure dsjob is in your path and ad d eval to cmd.

cmd="eval dsjob -run -jobstatus $ParmList $PROJECT $DSJOB"
${cmd}
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Ultramundane , where have you been all this time. You are right eval does work. You rule dude.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Ultramundane
Participant
Posts: 407
Joined: Mon Jun 27, 2005 8:54 am
Location: Walker, Michigan
Contact:

Post by Ultramundane »

Eval does two things.
1. Executes the entire argument passed to it as one command.
2. Goes through command substitution again.

Both are awesome. But 2 could be annoying.

But because of 2, you can now use a shell variable in your parameter file if you want.

Example:
STUFF=${PARM}

STUFF will take on the value of PARM for the shell building the command. To avoid this you need to use \\\

STUFF=\\\${STUFF}

Now STUFF shoud be the literal value ${STUFF}
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I was aware of that command but it never occured to me that it is the magic wand that is needed. Thanks for the info.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

Post by arsheshadri »

[quote="DSguru2B"]I was aware of that command but it never occured to me that it is the magic wand that is needed. Thanks for the info.[/quote]

Thank you all guys.
eval cmd worked..earlier I was copying the cmd to a temp file executing it..but now I don't have to.

Thanks again
cheers
sheshadri
Post Reply