Running & error handling of Parallel Job from Server Rou

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
Abhijit180
Participant
Posts: 1
Joined: Thu Oct 09, 2008 1:35 am
Location: Prague

Running & error handling of Parallel Job from Server Rou

Post by Abhijit180 »

Hi

Please any body share some routine snippet with a perfect error handling of the parallel job call.

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

Post by ray.wurlod »

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
ErrMsg = ""
RoutineName = "MyRoutine"
hJob = DSAttachJob(TheJobName, DSJ.ERRNONE)
JobName = DSGetJobInfo(hJob, DSJ.JOBNAME)
If JobName Matches "'-'1N0N"
Then
   ErrMsg = "Could not attach job."
End
Else
   * Optionally include call to DSPrepareJob here to "reset if required".
   GoSub SetParameters
   * how this is done depends heavily on where you get your parameter values
   ErrCode = DSRunJob(hJob, DSJ.RUNNORMAL)
   If ErrCode Matches "'-'1N0N"
   Then
      ErrMsg = "Run request failed. Error code = " : ErrCode
   End
   Else
      ErrCode = DSWaitForJob(hJob)
      ExitStatus = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
      Ans = ExitStatus
      Begin Case
         Case ExitStatus = DSJS.RUNOK
              Call DSLogInfo("Job finished OK", RoutineName)
         Case ExitStatus = DSJS.RUNWARN
               Call DSLogWarn("Job finished with at least one warning.", RoutineName)
         Case ExitStatus = DSJS.RUNFAILED
               Call DSLogWarn("Job failed (aborted).", RoutineName)
         Case ExitStatus = DSJS.STOPPED
               Call DSLogWarn("Job stopped by operator.", RoutineName)
         Case @TRUE ; * otherwise
               Call DSLogWarn("Job exit status is " : ExitStatus : ".", RoutineName)
      End Case
   End
   ErrCode = DSDetachJob(hJob)
End
If ErrMsg > ""
Then
   Call DSLogWarn(ErrMsg, RoutineName)
   Ans = -1
End
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