Page 1 of 1

Posted: Mon Jul 28, 2003 3:46 am
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

Posted: Mon Jul 28, 2003 6:53 am
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

Posted: Tue Jul 29, 2003 11:10 am
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

Posted: Tue Jul 29, 2003 6:02 pm
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