Tuesday, June 16, 2009

Reset scheduling job if server rebooting

Some time I have a problem with scheduled jobs - if server was restarted while job running - job status after this become aborted and schedule don't work. For solve this problem I write a routine to reset job if it's status is aborted. I schedule it for 5 minutes before start of main job.

Parameter: jobname - name of reseting job

$INCLUDE DSINCLUDE DSJ_XFUNCS.H
$INCLUDE DSINCLUDE JOBCONTROL.H

JobHandle = DSAttachJob(jobname, DSJ.ERRNONE)

if JobHandle = 0 Then
Call DSLogFatal('Job ' : jobname :' is not found', 'jobReset')
Ans = 1
End Else
jobstatus = DSGetJobInfo(JobHandle, 1)
if jobstatus <> DSJS.RUNNING Then
Call DSLogInfo('Job ' : jobname :' is not running', 'jobReset')
if jobstatus = DSJS.RUNFAILED Then
Call DSLogInfo('Job ' : jobname :' is aborted. Try to reset it', 'jobReset')
RunErr = DSRunJob(JobHandle, DSJ.RUNRESET)
if RunErr = 0 Then
Call DSLogInfo('Job ' : jobname :' is reset', 'jobReset')
End
End
End
Ans = 0
End

5 comments:

  1. hi, just want to know which language we use for routines. Is this BASIC??? and from where we get these $INCLUDE DSINCLUDE DSJ_XFUNCS.H functions and all?

    ReplyDelete
  2. Hi mate,
    This is really interesting to read all about

    Datastage Interview Questions

    ReplyDelete
  3. It was nice to see the best one to learn datastage online . Thanks for sharing this with us.


    Datastage Tutorial

    ReplyDelete