job control hard coded

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
bobby
Participant
Posts: 86
Joined: Mon Jul 19, 2004 8:31 pm

job control hard coded

Post by bobby »

hi,
Some one has written this code in Job Control in Datastage
Can u please advice wht can be best procedure to follow this.
Thanks,
Bobby

* Setup SAPimportParentDIST, run it, wait for it to finish, and test for success
hJob2 = DSAttachJob("SAPimportParentDIST", DSJ.ERRWARN)
If NOT(hJob2) Then
* Call DSLogFatal("Job Attach Failed: SAPimportParentDIST", "JobControl")
Call DSLogWarn("Job Attach Failed: SAPimportParentDIST", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob2, "myPath", "/datastage01/Ascential/DataStage/Projects/SAP_EQT/FilesIn/Distributor/")
ErrCode = DSRunJob(hJob2, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob2)
Status = DSGetJobInfo(hJob2, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
* Call DSLogFatal("Job Failed: SAPimportParentDIST", "JobControl")
End


* Setup SAPimportParentAGENT, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob("SAPimportParentAGENT", DSJ.ERRWARN)
If NOT(hJob1) Then
* Call DSLogFatal("Job Attach Failed: SAPimportParentAGENT", "JobControl")
Call DSLogWarn("Job Attach Failed: SAPimportParentAGENT", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "myPath", "/datastage01/Ascential/DataStage/Projects/SAP_EQT/FilesIn/Agents/")
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
* Call DSLogFatal("Job Failed: SAPimportParentAGENT", "JobControl")
End


* Setup ManufactJobMasterBDY, run it, wait for it to finish, and test for success
hJob3 = DSAttachJob("ManufactJobMasterBDY", DSJ.ERRWARN)
If NOT(hJob3) Then
* Call DSLogFatal("Job Attach Failed: ManufactJobMasterBDY", "JobControl")
Call DSLogWarn("Job Attach Failed: ManufactJobMasterBDY", "JobControl")
Abort
End
ErrCode = DSRunJob(hJob3, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob3)
Status = DSGetJobInfo(hJob3, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
* Call DSLogFatal("Job Failed: ManufactJobMasterBDY", "JobControl")
End


* Setup ManufactJobMaster, run it, wait for it to finish, and test for success
hJob4 = DSAttachJob("ManufactJobMaster", DSJ.ERRWARN)
If NOT(hJob4) Then
* Call DSLogFatal("Job Attach Failed: ManufactJobMaster", "JobControl")
Call DSLogWarn("Job Attach Failed: ManufactJobMaster", "JobControl")
Abort
End
ErrCode = DSSetJobLimit(hJob4, DSJ.LIMITROWS, 2)
ErrCode = DSRunJob(hJob4, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob4)
Status = DSGetJobInfo(hJob4, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
* Call DSLogFatal("Job Failed: ManufactJobMaster", "JobControl")
datastage
Participant
Posts: 229
Joined: Wed Oct 23, 2002 10:10 am
Location: Omaha

Post by datastage »

I think your question is a little vague or hard to understand exactly what you want to know... please rephrase and clarify.

I'm wondering if you are looking at the control logic here and are curious about what this developer has done versus what the default job control logic created by DataStage is, and are curious about what common or best practices are.

Certainly taking the default job control is common, but you are always free to modify to what best suits the needs of your organization and overall program flow.

In the posted job control if there is a failure to attach to the job an warning is generated when the default and normal practice is to abort right there. I don't see any particular logic related to any recovery methods so I'm guessing the intent here might be just so that a larger body of code that calls this job control doesn't abort if there are problems running these jobs, which may be fine if there isn't a problem with them not running, but this job control is definitely odd in that the DSLogFatals are removed.


Hope this helps and let us know if this is related to what you are looking for
Byron Paul
WARNING: DO NOT OPERATE DATASTAGE WITHOUT ADULT SUPERVISION.

"Strange things are afoot in the reject links" - from Bill & Ted's DataStage Adventure
Post Reply