Job control - Abort code

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
spracht
Participant
Posts: 105
Joined: Tue Apr 15, 2003 11:30 pm
Location: Germany

Post by spracht »

Massimiliano,

if the parameter names "NomeFile5", "Directory5" are wrong, i.e. the job in question doesn't have parameters named like that, DS will abort the controlling job by itself, as you specified:

hJob1 = DSAttachJob("OTCommonCopiaLog", DSJ.ERRFATAL)

if you do not want thsi you would have to say

hJob1 = DSAttachJob("OTCommonCopiaLog", DSJ.ERRWARN) or
hJob1 = DSAttachJob("OTCommonCopiaLog", DSJ.ERRNONE)

in that case you would have to control yourself if everything is OK. Maybe try the following:

ErrCode = DSSetParam(hJob1, "NomeFile5", "4")
ErrCode += DSSetParam(hJob1, "Directory5", "5")
If ErrCode Then
Call DSLogFatal("Prima della DSRunJob()!!!", "JobControl")
End
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)

If the error really lies with the DSRunJob statement, I think there something wrong with job "OTCommonCopiaLog"???


Stephan
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Anyone writing job control to deal with dynamically setting parameters should look into using the DSGetJobIfno(jobHandle, DSJ.PARAMLIST) function call to "ask" a job for a list of its parameters. Once you have this list, you know what parameters are available in a job for runtime setting. You won't have the error posted here if you do this first.

Kenneth Bland
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Massimiliano

I think this is the same problem as your other question. You cannot attach to the current job in job control. You create a controlling job which runs all your other jobs and it can trap all the errors or aborts of the other jobs. Both Stephen and Ken are right in this job you should check the parameters before you set them to make sure they are valid for the job you are about to run.

Kim.

Kim Duke
DwNav - ETL Navigator
www.Duke-Consulting.com
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I never use DSLogFatal, or Abort, or the DS.ERRFATAL key with DSAttachJob() in DataStage jobs or in routines called from them. This way I always retain control. I can detect what happed from log entries (for example using DSGetNewestLogId function) or from the controlled job's status (for example using DSGetJobInfo function) and react accordingly.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Post Reply