Job Control Aborting with "Job is not a runnable state&

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
fgallet
Participant
Posts: 10
Joined: Thu Mar 31, 2005 3:09 am

Job Control Aborting with "Job is not a runnable state&

Post by fgallet »

Hi !

I have a job control which failed with the message below :

[i]DTMCtrlFaitSCMMens..JobControl (fatal error from DSRunJob): Job control fatal error (-2)
(DSRunJob) Job DTMAlimNBOS is not in a runnable state[/i]

When i check the DTMAlimNBOS job, it's correctly compiled and the job have [b][u]Run[/u][/b] !!! :shock:

here a piece of the job control code :

* Setup DTMAlimNBOS, run it, wait for it to finish, and test for success
hJob3 = DSAttachJob("DTMAlimNBOS", DSJ.ERRFATAL)
If NOT(hJob3) Then
Call DSLogFatal("Job Attach Failed: DTMAlimNBOS", "JobControl")
Abort
End
LimitErr= DSSetJobLimit(hJob3,DSJ.LIMITWARN,MaxWarning)
ErrCode = DSSetParam(hJob3, "dsn_cible", dsn_DTM)
ErrCode = DSSetParam(hJob3, "usr_cible", usr_DTM)
ErrCode = DSSetParam(hJob3, "pwd_cible", pwd_DTM)
ErrCode = DSSetParam(hJob3, "dsn_source", dsn_DWH)
ErrCode = DSSetParam(hJob3, "usr_source", usr_DWH)
ErrCode = DSSetParam(hJob3, "pwd_source", pwd_DWH)
ErrCode = DSRunJob(hJob3, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob3)
Status = DSGetJobInfo(hJob3, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: DTMAlimNBOS", "JobControl")
End
If Status = DSJS.RUNWARN Then
Call DSLogWarn("Job Warning : DTMAlimNBOS" ,"JobControl")
End

Any Idea ?

thanks a lot

Fred
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Your code seem to be ok. Try to recompile the both the job and the routine and try again. If this the same case for most of other job, tyr REINDEX with complet access to the project.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

instead

Code: Select all

ErrCode = DSRunJob(hJob3, DSJ.RUNNORMAL)
Try with

Code: Select all

ErrCode = DSRunJob(hJob3, DSJ.RUNRESET)
Success consists of getting up just one more time than you fall.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Doing that would only reset the job, not reset it and then run it. If you want to emulate the 'Reset if required then run' functionality of a Sequence job, you need to do both.

And if you want to do it 'right', check the status of the job and only issue the RUNRESET if you need to. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, your code seems to be 'fine', being pretty much exactly what DataStage generates when you use the 'Add Job' button.

That being said, this kind of problem is just usually a timing problem. Some other process (or person) ran the job and when this one tried to you got the dreaded 'job is not in a runnable state' message - because it was already running! :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply