How to trap the exit status code value of a dsjob command ?

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
kumarjit
Participant
Posts: 99
Joined: Fri Oct 12, 2012 7:47 am
Location: Kolkata

How to trap the exit status code value of a dsjob command ?

Post by kumarjit »

I went through numerous posts and I wasnt able to find that one piece of GOLD which can bail me out of this misery.

The scenario is : I am executing the "dsjob" command from our Unix prompt(using a shell script) and passing the same project name and job name to it , and the differences being in the usage of the following options of the command .
a) -mode
b) -jobstatus
i.e., once I am executing the dsjob command with these options, and once I am not using them.


What is required : To store the status of the dsjob command(and not the status of the datastage job) , i.e., the staus code returned by the dsjob command to the OS


Whats the problem :
While using the Unix command " echo $? " right after executing the dsjob command , I am a value of 0 when the dsjob command runs SUCCESSFULLY without its options,
and 1 when the dsjob command runs SUCCESSFULLY with the options used alongwith (mentioned above ) .


Question :
IF THE DSJOB COMMAND RUNS SUCCESSFULLY , IT WOULD ONLY RETURN 0 AS THE STATUS CODE , NO MATTER WHAT OPTIONS ARE USED ALONGWITH THE COMMAND ITSELF. BUT ITS NOT HAPPENING THAT WAY .

CAN ANY BODY HELP ME OUT WITH THIS ISSUE ?


Thanks
Kumarjit.
Pain is the best teacher, but very few attend his class..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You don't want -jobstatus as that reflects the value the job returned. You should be able to use -wait for a simple 0/1 return status, assuming you want to wait for the job to complete, that is.
-craig

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