Page 1 of 1

Server Routine aborted while calling from Job sequencer

Posted: Mon Mar 14, 2011 12:29 pm
by somu_june
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

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("-----------------------------------")
Can some one help me in fixing my before/after subroutine which is not working

Thanks,
Raju

Posted: Mon Mar 14, 2011 5:44 pm
by chulett
Reset the aborted job and let us know the contents of a "From previous run..." log message, if one shows up.

Posted: Mon Mar 14, 2011 6:14 pm
by ray.wurlod
You can not call before/after subroutines directly from seqences. You need to re-create this routine as a transform function if you want to call it via a Routine activity. Or you could build a transform function that is an interlude to the before/after subroutine.

Posted: Mon Mar 14, 2011 8:10 pm
by chulett
Doh... missed that part. I'm surprised you were able to select it from inside the stage, thought it filtered out things of that nature.