Problem with dsjob command...

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Problem with dsjob command...

Post by kaps »

I have a weird issue going on. We run jobs using dsjob command which runs fine in one environment but not in the other.

I use the following command.

dsjob -run -jobstatus $prm_project $prm_job


Return value I get from this command is "waiting for job..." in the environment where it fails.

My understanding is that it needs to wait for the job to complete and then return value.

I have a step in my script which checks for the return value of this command like this.

if test $Run_Stat_Val -eq 1
then
Ret_Val=0
else
exit 99
fi

This fails because it's a string value. What I don't understand is why it runs fine in one place but not in other place.
Is there any environment changes causing this and is there a way I can check it ?

Appreciate your help...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? I don't understand what you are asking or what your 'failure' is. Yes, it will wait for the job to complete before returning. Explain what fine versus not fine across environments means in detail. Please.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

I am sorry...Let me rephrase it..Why am I getting the return value from the dsjob command as "Waiting for job..." instead of some integer when I use Jobstatus in dsjob coammand ?

I am using the same script in both environments but one environment it fails because I get value "Waiting for job..." instead of integer but in Production environment it never fails.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Are you sure that is the return status? Or does it simply echo that to the screen while the job is running? I'd also be curious exactly how you are capturing the status into your $Run_Stat_Val variable - can you post that segment of the script?
-craig

"You can never have too many knives" -- Logan Nine Fingers
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

Craig

Thanks for the reply. Below is the code snippet...

Code: Select all

Run_Stat=`dsjob -run -jobstatus $prmStr $prm_project $prm_job 2> /dev/null`
echo Run_Stat is $Run_Stat >> $Script_LogDir/$Script_LogFileName
Run_Stat_Null=${Run_Stat:="Y"}
echo Run_Stat_Null is $Run_Stat_Null >> $Script_LogDir/$Script_LogFileName
if [[ "$Run_Stat_Null" = "Y" ]];
then
echo Job is in Bad State >> $Script_LogDir/$Script_LogFileName
exit 99;
fi;
Run_Stat_Val=`echo $Run_Stat | head -1 | cut -d"(" -f2 | cut -d")" -f1`
echo Run_Stat_Val is $Run_Stat_Val >> $Script_LogDir/$Script_LogFileName
Run_Stat_Val_Null=${Run_Stat_Val:="Y"}
echo Run_Stat_Val_Null is $Run_Stat_Val_Null >> $Script_LogDir/$Script_LogFileName
if [[ "$Run_Stat_Val_Null" = "Y" ]];
then
echo Job is in Bad State >> $Script_LogDir/$Script_LogFileName
exit 99;
fi
Please advise.

Thanks
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

Anyone has any idea ? I am still having this issue...
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Don't redirect your errors to /dev/null, redirect them to a file and see if any messages are in that file after the run.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'd also add a suggestion to not set Run_Stat that way but instead run the command directly and then capture $? and see if that changes things.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply