Job Control Error
Posted: Wed Oct 10, 2007 7:33 am
HI,
I have routine to send an email when job gets aborted.
It is working fine so far.Now I wanted to reset the job after sending mail.I added few lines to that routine .I am getting following error
.AfterJob (DSAttachJob): Job control error (-12)
(DSOpenJob) Invalid job name '1'
I added
hJob = DSAttachJob(DSJ.ME, DSJ.ERRWARN)
hJob = DSPrepareJob(hJob)
these 2 lines to reset the job
this is the routine
Can you please help me in finding the problem
Thanks
Sri
I have routine to send an email when job gets aborted.
It is working fine so far.Now I wanted to reset the job after sending mail.I added few lines to that routine .I am getting following error
.AfterJob (DSAttachJob): Job control error (-12)
(DSOpenJob) Invalid job name '1'
I added
hJob = DSAttachJob(DSJ.ME, DSJ.ERRWARN)
hJob = DSPrepareJob(hJob)
these 2 lines to reset the job
this is the routine
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
JobHandle = DSJ.ME
JobName = DSGetJobInfo(JobHandle,DSJ.JOBNAME)
call DSLogInfo("Job Name":JobName, "DSSendMail");
J1stat = DSGetJobInfo(DSJ.ME,DSJ.JOBINTERIMSTATUS);
Jobstat = DSGetJobInfo(DSJ.ME,DSJ.JOBSTATUS);
StartTimestamp = DSGetJobInfo(JobHandle,DSJ.JOBSTARTTIMESTAMP);
EndTimestamp = DSGetJobInfo(JobHandle,DSJ.JOBLASTTIMESTAMP);
SummaryArray = DSGetLogSummary (JobHandle, DSJ.LOGANY,StartTimestamp , EndTimestamp , 50)
hJob = DSAttachJob(DSJ.ME, DSJ.ERRWARN)
If J1stat =2 or J1stat=3 Then
hJob = DSPrepareJob(hJob)
Line="Failed or completed with warnings"
message=''
message=InputArg:"\nBody:"
message=message :JobName:J1stat:Line :"\n" :JobHandle :StartTimestamp : "\n" : SummaryArray
Reply = DSSendMail(message)
End
Thanks
Sri