Reset job

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
rajeev_prabhuat
Participant
Posts: 136
Joined: Wed Sep 29, 2004 5:56 am
Location: Chennai
Contact:

Reset job

Post by rajeev_prabhuat »

Hi,

I am calling UtilityRun Job from a transformer, which should execute the jobs one by one. But i want to reset the job first and then run the job, can you give me a solution.

Note: I cannot reset the job mannually.

Regards,
Rajeev Prabhu
davidnemirovsky
Participant
Posts: 85
Joined: Fri Jun 04, 2004 2:30 am
Location: Melbourne, Australia
Contact:

Post by davidnemirovsky »

Create a sequence job. Add a 'Job Activity' stage. In the properties of the stage select the job name and then in the 'Execution Action' drop down box select 'Reset if required, then run'.
Cheers,
Dave Nemirovsky
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

After you attach to a job then you need to check the status. Here is the code you need to add.

Code: Select all

               LastRunStatus = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
               If LastRunStatus = DSJS.RUNFAILED Or LastRunStatus = DSJS.CRASHED Or LastRunStatus = DSJS.STOPPED Then
                  Call DSLogInfo(JobReportName, "Reseting job and last run status")
                  ErrCode = DSRunJob(hJob1, DSJ.RUNRESET)
                  ErrCode = DSWaitForJob(hJob1)
                  ErrCode = DSDetachJob(hJob1)
                  hJob1 = DSAttachJob(JobReportName, DSJ.ERRFATAL)
                  If NOT(hJob1) Then
                     Call DSLogFatal("Job Attach Failed: ":JobReportName, "JobControl")
                     Abort
                  End
               end
Mamu Kim
Post Reply