Page 1 of 2

dsjob command

Posted: Tue Jun 12, 2007 1:11 am
by pravin1581
Hi All,

How can i trap the status of the job thru dsjob command .If any job gets aborted then is it necessary to compile the job in the designer before running the dsjob command ?

Posted: Tue Jun 12, 2007 3:45 am
by OddJob
Place the Job on a Sequence and call the Sequence from dsjob.

If you double-click on the Job Activity on the Sequence and select the 'Job' tab you can choose 'Reset if required, then run' from the 'Execute action' dropdown - your job will always run even if it is in status 'Aborted'.

Posted: Tue Jun 12, 2007 4:00 am
by pravin1581
OddJob wrote:Place the Job on a Sequence and call the Sequence from dsjob.

If you double-click on the Job Activity on the Sequence and select the 'Job' tab you can choose 'Reset if required, then run' from the 'Execute action' dropdown - your job will always run even if it is in status 'Aborted'.
The job should be a job and not a sequence. The problem of status is even if the job is getting aborted the status still returns as 0 which is making difficult to get the status of the job. I want that for those runs for which the status is aborted the status should be something else which helps me in detect the error.

Posted: Tue Jun 12, 2007 5:32 am
by ray.wurlod
The job status is available on file unit #2 (stderr). If you specify the -jobstatus option, the job status of dsjob is the exit status of the job itself, on file unit #1 (stdout). It is documented thus.

Re: dsjob command

Posted: Tue Jun 12, 2007 5:59 am
by chulett
pravin1581 wrote:1) How can i trap the status of the job thru dsjob command. 2) If any job gets aborted then is it necessary to compile the job in the designer before running the dsjob command ?
1) Use the -jobstatus dsjob option as noted. The behaviour of it is well documented.

2) No. It does need to be RESET however and there is a specific dsjob 'run mode' for that. Your wrapper script needs to check for a condition requiring a reset and do so before running the job.

Posted: Tue Jun 12, 2007 7:42 am
by OddJob
If any job gets aborted then is it necessary to compile the job in the designer before running the dsjob command ?
By detailing the use of a sequence I was trying to show you how to re-run an aborted job without having to compile or reset the job.

Posted: Tue Jun 12, 2007 7:49 am
by chulett
And what if the Sequence job itself aborts? The problem remains to be solved regardless of job type. :wink:

Re: dsjob command

Posted: Wed Jun 13, 2007 11:32 pm
by pravin1581
chulett wrote:
pravin1581 wrote:1) How can i trap the status of the job thru dsjob command. 2) If any job gets aborted then is it necessary to compile the job in the designer before running the dsjob command ?
1) Use the -jobstatus dsjob option as noted. The behaviour of it is well documented.

2) No. It does need to be RESET however and there is a specific dsjob 'run mode' for that. Your wrapper script needs to check for a condition requiring a reset and do so before running the job.
I have tried using the option mode RESET, it resets the job but the job is not running.The command that i have tried is as follows:

Code: Select all


     dsjob -run -mode RESET projectname jobname


Posted: Thu Jun 14, 2007 1:12 am
by ray.wurlod
Any messages generated?
What is the exit status of dsjob?
Include -jobstatus option and post whether that makes a difference.

Posted: Mon Jun 18, 2007 9:58 pm
by pravin1581
ray.wurlod wrote:Any messages generated?
What is the exit status of dsjob?
Include -jobstatus option and post whether that makes a difference.
I have included -jobstatus in the command and it is working fine. It returns 2 if there is any warning in the job else 3 if the job is aborted and 1 if it is finished w/o any warning. But the problem of compiling still persists, it has to be compiled if it is getting aborted.

Posted: Mon Jun 18, 2007 10:49 pm
by ray.wurlod
It does NOT have to be re-compiled if it aborted. It only needs to be reset. You can accomplish this with dsjob -run -mode RESET ...

You can also accomplish it automatically ("reset if required, then run") if running your job from a job sequence - the job sequence can be started from dsjob.

Posted: Mon Jun 18, 2007 11:41 pm
by pravin1581
ray.wurlod wrote:It does NOT have to be re-compiled if it aborted. It only needs to be reset. You can accomplish this with dsjob -run -mode RESET ...

You can also accomplish it automatically ("reset if required, then run") if running your job from a job sequence - the job sequence can be started from dsjob.
In case of job sequence i am aware of this property ("reset if required, then run") but i want the same in case of a job and not job sequence.

Posted: Mon Jun 18, 2007 11:57 pm
by ArndW
There is no "reset if required" from the command line, but you can always just force a reset and then run the job.

Posted: Tue Jun 19, 2007 1:10 am
by pravin1581
ArndW wrote:There is no "reset if required" from the command line, but you can always just force a reset and then run the job.
So the only way out is to recompile the job from the designer and then run it using dsjob command.

Posted: Tue Jun 19, 2007 1:38 am
by ray.wurlod
FORGET re-compile. It is not necessary!

You can reset the job from dsjob.
You can even test whether it needs to be reset (Aborted = 3).

After resetting, the job status will be 21 (has been reset).
Then you can run the job normally.

No need to re-compile.

Are you listening?