Server Routine aborted while calling from Job sequencer
Posted: Mon Mar 14, 2011 12:29 pm
Hi,
I have a server routine which writes the waraning messages and fatal error messages of a job to a txt file and also to the job log. The routine compiled with no errors. But when calling the routine from Routine activity from job sequence it is aborted by throwing below warning
Attempting to Cleanup after ABORT raised in stage Copy_Test11..JobContro
Routine Code
Can some one help me in fixing my before/after subroutine which is not working
Thanks,
Raju
I have a server routine which writes the waraning messages and fatal error messages of a job to a txt file and also to the job log. The routine compiled with no errors. But when calling the routine from Routine activity from job sequence it is aborted by throwing below warning
Attempting to Cleanup after ABORT raised in stage Copy_Test11..JobContro
Routine Code
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = FIELD(Arg1,"|",1)
***hJob1 = DSAttachJob(JobName, DSJ.ERRFATAL)
***latestID = DSGetNewestLogId(hJob1,DSJ.LOGANY)
jobStart = DSGetJobInfo (hJob1, DSJ.JOBSTARTTIMESTAMP)
***For eventID = latestID To 4410 Step -1
**eventDetail = DSGetLogEntry(hJob1,eventID)
**evtDate = FIELD(eventDetail,"\",1)
**evtDate = CHANGE(evtDate,"Date: ","")
JobStatsDir = "/home/n50619"
ProcessID = "ECP"
Category = "WrthClm_000006"
BatchSeq = "20110228"
JobFinish = "2011-02-28 13:39:07"
JobStatus = "Finished"
RestartFlag = "N"
Action = "U"
TableName = "ETLJobProgramName"
***DSJobController = "SeqUpdateETLJobFileControl"
inID = ProcessID:"_":Category
hJob1 = DSAttachJob(JobName, DSJ.ERRFATAL)
jobStart = DSGetJobInfo (hJob1, DSJ.JOBSTARTTIMESTAMP)
latestID = DSGetNewestLogId(hJob1,DSJ.LOGANY)
DIM evtVector(latestID)
DIM errVector(latestID)
DIM errTypeVector(latestID)
Call DSLogInfo("Job Control List: " : hJob1)
Call DSLogInfo("This Job name:" : hJob1)
For eventID = latestID To 1 Step -1
eventDetail = DSGetLogEntry(hJob1,eventID)
evtDate = FIELD(eventDetail,"\",1)
evtDate = CHANGE(evtDate,"Date: ","")
evtMessage = FIELD(eventDetail,"\",4)
evtType = Field(eventDetail,"\",3)
If evtDate < jobStart Then Exit
errVector(eventID) = ""
If evtType = "2" Then
errFlag = @True
errVector(eventID) = evtMessage
errTypeVector(eventID) = "Warning"
End
If evtType = "3" Then
errFlag = @True
errVector(eventID) = evtMessage
errTypeVector(eventID) = "Fatal"
End
Next eventID
If (errFlag) Then
ErrorFile = JobStatsDir:"/":inID:"_":JobName:"_Job_Errors.txt_":BatchSeq
OPENSEQ ErrorFile TO updFile
Then
WEOFSEQ updFile
End Else
CREATE updFile Else
Call DSLogInfo("","")
Call DSLogInfo("-----------------------------------","")
Call DSLogInfo("","")
Call DSLogInfo("ERROR in after job routine UpdateETLJobRunErrors","")
Call DSLogInfo("Unable to create or open job error file :":ErrorFile,"")
Call DSLogInfo("For DSJOB:":JobName,"")
Call DSLogInfo("","")
Call DSLogInfo("-----------------------------------","")
Call DSLogInfo("","")
ErrorCode = 0
RETURN
End
End
End
Call DSLogToController("-----------------------------------")
Call DSLogToController("")
Call DSLogToController("Job warning and fatal log messages are being logged into job control")
Call DSLogToController("")
Call DSLogToController("-----------------------------------")
Thanks,
Raju