dsjob command

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

pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

dsjob command

Post 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 ?
OddJob
Participant
Posts: 163
Joined: Tue Feb 28, 2006 5:00 am
Location: Sheffield, UK

Post 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'.
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: dsjob command

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
OddJob
Participant
Posts: 163
Joined: Tue Feb 28, 2006 5:00 am
Location: Sheffield, UK

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

And what if the Sequence job itself aborts? The problem remains to be solved regardless of job type. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Re: dsjob command

Post 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

ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Any messages generated?
What is the exit status of dsjob?
Include -jobstatus option and post whether that makes a difference.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply