Server Routine aborted while calling from Job sequencer

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Server Routine aborted while calling from Job sequencer

Post 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
somaraju
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Reset the aborted job and let us know the contents of a "From previous run..." log message, if one shows up.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply