DSWaitForJob function

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
satyamohan
Participant
Posts: 3
Joined: Wed Feb 11, 2004 9:19 am

DSWaitForJob function

Post by satyamohan »

Hi,
I have a Batch code that I need to call. The scenario is that
hJob10 in the example below needs to wait for hJob8 and hJob9
I get a compilation error in the following line--
ErrCode = DSWaitForJob(hJob8,hJob9)
The help says that I can pass comma separated handles to the DSWaitForJob function.

Pl help
********************
MakeBaseDataSetFA:
* Setup MakeBaseDataSetFA, run it, wait for it to finish, and test for success
hJob8 = DSAttachJob("MakeBaseDataSetFA", DSJ.ERRFATAL)
If NOT(hJob8) Then
Call DSLogFatal("Job Attach Failed: MakeBaseDataSetFA", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob8, "TempDir", TempDir)
ErrCode = DSSetParam(hJob8, "HashDir", HashDir)
ErrCode = DSSetParam(hJob8, "InFile", OutFileName_step1)
ErrCode = DSSetParam(hJob8, "OutFile", OutFileName)
ErrCode = DSSetParam(hJob8, "HCollTime", HCollTime)
ErrCode = DSSetParam(hJob8, "HContact", HContact)
ErrCode = DSSetParam(hJob8, "HCustContact", HCustContact)
ErrCode = DSSetParam(hJob8, "HTSYSEvent", HTSYSEvent)
ErrCode = DSSetParam(hJob8, "HFICO", HFICO)
ErrCode = DSSetParam(hJob8, "HScore", HScore)
ErrCode = DSSetParam(hJob8, "HContact", HContact)
ErrCode = DSSetParam(hJob8, "HACD", HACD)
ErrCode = DSSetParam(hJob8, "BTAcqFile", BTAcqFile)


ErrCode = DSRunJob(hJob8, DSJ.RUNNORMAL)
*ErrCode = DSWaitForJob(hJob8)
Status = DSGetJobInfo(hJob8, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: MakeBaseDataSetFA", "JobControl")
End
Return
********************************************************************************
CCDFSetAcqInfo:
* Setup CCDFSetAcqInfo, run it, wait for it to finish, and test for success
hJob9 = DSAttachJob("CCDFSetAcqInfo", DSJ.ERRFATAL)
If NOT(hJob9) Then
Call DSLogFatal("Job Attach Failed: CCDFSetAcqInfo", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob9, "DWSid", DWSid)
ErrCode = DSSetParam(hJob9, "DWLogon", DWLogon)
ErrCode = DSSetParam(hJob9, "DWPwd", DWPwd)
ErrCode = DSSetParam(hJob9, "DWSidTarget", DWSid)
ErrCode = DSSetParam(hJob9, "DWLogonTarget", DWLogon)
ErrCode = DSSetParam(hJob9, "DWPwdTarget", DWPwd)
ErrCode = DSSetParam(hJob9, "TempDir", TempDir)
ErrCode = DSSetParam(hJob9, "HashDir", HashDir)
*ErrCode = DSSetParam(hJob9, "Period", Period)
ErrCode = DSRunJob(hJob9, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob9)
Status = DSGetJobInfo(hJob9, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: CCDFSetAcqInfo", "JobControl")
End

Return
********************************************************************************
CCDFSetBTAcqInfo:
* Setup CCDFSetBTAcqInfo, run it, wait for it to finish, and test for success
hJob10 = DSAttachJob("CCDFSetBTAcqInfo", DSJ.ERRFATAL)
If NOT(hJob10) Then
Call DSLogFatal("Job Attach Failed: CCDFSetBTAcqInfo", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob10, "DWSid", DWSid)

ErrCode = DSSetParam(hJob10, "DWLogon", DWLogon)
ErrCode = DSSetParam(hJob10, "DWPwd", DWPwd)

ErrCode = DSSetParam(hJob10, "TempDir", TempDir)
ErrCode = DSSetParam(hJob10, "InFile", BTAcqFile)
ErrCode = DSSetParam(hJob10, "Period", Period)
ErrCode = DSRunJob(hJob10, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob8,hJob9)
Status = DSGetJobInfo(hJob10, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: CCDFSetBTAcqInfo", "JobControl")
End
if ErrCode <>0 then
Call DSLogFatal("Job Failed: CCDFSetBTAcqInfo", "JobControl")
End
Return
********************************************************************************
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You will need to call the function as follows:

Code: Select all

ErrCode = DSWaitForJob(hJob8:',':hJob9)
satyamohan
Participant
Posts: 3
Joined: Wed Feb 11, 2004 9:19 am

Post by satyamohan »

Thanks. It worked
Post Reply