DSWaitForJob Problem

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
bdixon
Participant
Posts: 35
Joined: Thu Nov 20, 2003 5:45 pm
Location: Australia, Sydney

DSWaitForJob Problem

Post by bdixon »

We are having a problem where we have a batch program that has a number of jobs in it. We have experienced 3 different occurences when the DSWaitForJob has not waited and the next job has executed at the very same time and caused major problems with our system.

Is there any known problems that have cause this problem?

Can anyone please assist.

Sample Code:

hJob8 = DSAttachJob("PopDailySavingsTran", DSJ.ERRFATAL)
ErrCode = DSSetParam(hJob8, "InternalDay", InternalDay)
ErrCode = DSSetParam(hJob8, "DataSourceName", DataSourceName)
ErrCode = DSSetParam(hJob8, "DataFileDirectory", DataFileDirectory)
ErrCode = DSSetParam(hJob8, "LogFileDirectory", LogFileDirectory)
ErrCode = DSSetParam(hJob8, "DiscardFileDirectory", DiscardFileDirectory)
ErrCode = DSSetParam(hJob8, "ControlFileDirectory", ControlFileDirectory)
ErrCode = DSSetParam(hJob8, "UniDataDirectory", UniDataFileDirectory)
ErrCode = DSSetParam(hJob8, "InputFileName", "UDTRAN.SEQ.":InternalDay)
ErrCode = DSRunJob(hJob8, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob8)
Status = DSGetJobInfo(hJob8, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: PopDailySavingsTran", "JobControl")
End

RenameTable = 'Daily_Savings'
Gosub RenameFile
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The obvious thing in this automatically generated code is that no checking has been done to make sure that all the parameter values were set correctly, or even that job PopDailySavingsTran was attached correctly and was in a runnable state.
Check the job log for PopDailySavingsTran and tell us whether it ran successfully and, if so, what the parameter values were (these are in the "job started" event in the job log). If any of these problems mean that job PopDailySavingsTran does not start, then the batch - depending on how it was set up - will merrily go on to run the next job straight away.
You need to build a lot more checking into your batch code, including that the job is attached, that the parameter values are set correctly, that the job is in a runnable state and that the previous job did not abort.
Chances are the problem is not in DSWaitForJob, though it's possible. Contact your support provide to see whether there are any known issues in version 5, which is quite an old version now.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bdixon
Participant
Posts: 35
Joined: Thu Nov 20, 2003 5:45 pm
Location: Australia, Sydney

Post by bdixon »

I have check the job and it did run with the following parameters:
Starting Job PopDailySavingsTran.
InternalDay = 13122
DataSourceName = production
DataFileDirectory = W:\data\production\rdbLoadFiles\DataFiles
LogFileDirectory = W:\data\production\rdbLoadFiles\LogFiles
DiscardFileDirectory = W:\data\production\rdbLoadFiles\DiscardFiles
ControlFileDirectory = W:\data\production\rdbLoadFiles\ControlFiles
UniDataDirectory = W:\data\production\InputData\FACTSFiles\UniData
InputFileName = UDTRAN.SEQ.13122
DSJobController = Batch::PopulateDailySavings

So I assume that the job has attached successfully however the waitforjob did not actually wait......
Also the job before and job after run successfully. Although the job after was kicked off at the same time as the above job.

In addition we did get the following warning message from PopDailySavingsTran:
DataStage Job 4837 Phantom 3892
The process cannot access the file because it is being used by another process.
DataStage Phantom Finished
Post Reply