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
Job control - Abort code
Moderators: chulett, rschirm, roy
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
Kenneth Bland
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518