To Reset the DS Job if the status is Abort using Routine

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
pavithra_12
Participant
Posts: 13
Joined: Thu Mar 17, 2005 1:20 am

To Reset the DS Job if the status is Abort using Routine

Post by pavithra_12 »

Hi,

Please let me know how to create a routine that checks the DS Job status and Reset if the status of the job is Abort.

Regards
Pavithra
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The routine would contain:

- a call to DSAttachJob that you wish to reset
- a call to DSGetJobInfo to get the current status
- a call to DSPrepareJob to make the job runnable
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

... and a DSDetachJob to indicate that you're finished with it and another process doesn't get a "locked" message.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
120267
Participant
Posts: 30
Joined: Tue Jun 07, 2005 12:27 am

Post by 120267 »

Hi pavithra,

This is the routine to reset the job.

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
If DSGetJobInfo(hJob, DSJ.JOBSTATUS) = DSJS.STOPPED or DSGetJobInfo(hJob, DSJ.JOBSTATUS) = DSJS.RUNFAILED
or DSGetJobInfo(hJob, DSJ.JOBSTATUS) = DSJS.CRASHED
Then
Message = "Job is resetting..."
Call DSLogInfo(Message, RoutineName)
ErrCode = DSRunJob(hJob, DSJ.RUNRESET)
Ans = ErrCode
Status = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
Message = "Job Reset Failed: ":hJob:"."
Call DSLogWarn(Message, RoutineName)
End
End

Thanks,
Siva
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

ray.wurlod wrote:... and a DSDetachJob to indicate that you're finished with it and another process doesn't get a "locked" message.
You caught me out; I noticed the omission when I posted yesterday and was too lazy to go back and edit the post; even though I knew that you would notice and correct my error.
Post Reply