Aside from proper syntax, is there anything else needed to get the DWWaitForFile before-job subroutine such as scheduling the job or anything else. I have the correct path in the DSWaitForFile test box and I also have the correct path in for my SrcDir....do I need to add a parameter for DSWaitForFile?
My syntax is
Reply = DSWaitForFile("\DataStage60\Ascential\DataStage\Projects\morphius\Household.csv timeout:3600/60")
Anything wrong with this?
DSWaitForFile
Moderators: chulett, rschirm, roy
The code generated in a batch job looks like this:
Notice DSWaitForJob(hJob1) where hJob1 is the return from DSAttachJob. This is a special variable and not the path to the job running. It is a pointer to the job. You cannot shortcut this process. You need all these steps to run a job and wait for it. This code is easily generated in job control of a batch job. All you have to do is select a job from the drop down list.
Kim.
Code: Select all
* Setup GetInformixMetadata, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob("GetInformixMetadata", DSJ.ERRFATAL)
ErrCode = DSSetParam(hJob1, "pSystemId", SystemId)
ErrCode = DSSetParam(hJob1, "pSID", SID)
ErrCode = DSSetParam(hJob1, "pSourceName", DsnId)
ErrCode = DSSetParam(hJob1, "pUserId", UserId)
ErrCode = DSSetParam(hJob1, "pPwd", Pwd)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: GetInformixMetadata", "JobControl")
End
Kim.
Mamu Kim
Just to get picky... Doing this in a before routine, the job won't "kick off" when the file arrives. You'll need to start the job and then the DSWaitForFile routine will poll for the existence of the file. Once the file shows up or your polling window is exceeded, the meat of the job will continue on.
Your syntax looks fine, what kind of problem are you having exactly? You may want to consider using the routine in a controlling Batch Job instead of a before-job routine. That way you can run the job that processes the file when it shows up or not run the job if it fails to show up and alert someone to that fact.
Your syntax looks fine, what kind of problem are you having exactly? You may want to consider using the routine in a controlling Batch Job instead of a before-job routine. That way you can run the job that processes the file when it shows up or not run the job if it fails to show up and alert someone to that fact.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers