DS Job hagging when called an After Job routine

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
anusha
Premium Member
Premium Member
Posts: 37
Joined: Wed Nov 28, 2007 1:29 am
Location: pune

DS Job hagging when called an After Job routine

Post by anusha »

Hi All,

I have written an After-Job routine to retrive the Job statistics. My job is hanging when it is encoutering the command DSAttachJob and the State of the job is always running. I am not sure why it is behaving this way.
Here is my roUtine:

Code: Select all

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF    
*** Get the Statistics for the Current Job 
      JOBNAME= DSJobName
      Call DSLogInfo ( "JobName ":JOBNAME,"dsrAuditCntrlInfo")
      Hjob = DSAttachJob(JOBNAME,DSJ.ERRFATAL)
      if NOT(Hjob) then
      call DSLogFatal( "Job Failed ":JOBNAME,"dsrAuditCntrlInfo")
      ABORT
      end
      Return= SOURCE_NAME matches "0X'TB_ODS_ZINC'0X"
      Call DSLogInfo ( "Value of Return Code ":Return,"dsrAuditCntrlInfo")
      if Return = 1 then
          SUBJECT='ABC'
      end
      else
          SUBJECT='XYZ'
      end
      Call DSLogInfo ( "Value of SUBJECT ":SUBJECT,"dsrAuditCntrlInfo")
      EXECSTATUS = DSGetJobInfo (Hjob, DSJ.JOBSTATUS)
      Call DSLogInfo ( "Value of EXECSTATUS ":EXECSTATUS,"dsrAuditCntrlInfo")
      JOBSTARTTIME = DSGetJobInfo (Hjob, DSJ.JOBSTARTTIMESTAMP)
      Call DSLogInfo ( "Value of JOBSTARTTIME ":JOBSTARTTIME,"dsrAuditCntrlInfo")

      JOBENDTIME = DSGetJobInfo (Hjob, DSJ.JOBLASTTIMESTAMP)
      Call DSLogInfo ( "Value of JOBENDTIME ":JOBENDTIME,"dsrAuditCntrlInfo")

      JOBELAPSTIME = DSGetJobInfo (Hjob, DSJ.JOBELAPSTIMESTAMP)
      Call DSLogInfo ( "Value of JOBELAPSTIME ":JOBELAPSTIME,"dsrAuditCntrlInfo")

      DetachResult = DSDetachJob(Hjob)
Can any one please help me to resolve the issue. I have used the Job control macros in After Job Subroutine
anusha
Premium Member
Premium Member
Posts: 37
Joined: Wed Nov 28, 2007 1:29 am
Location: pune

Post by anusha »

Now i am getting the following error after running for few minutes.

Code: Select all

AfterJob (fatal error from DSAttachJob): Job control fatal error (0)
(DSCloseJob) Cannot refer to own job handle
(DSAttachJob) Failed to lock job after 1800 seconds
Since i am calling the DSAttachJob in After Job routine by checking in the job property Omly run After-jon routine on successful completion of the job it should not be a problem.

Any help is highly appriciated!

Thanks.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A job can not attach to itself. Do not call DSAttachJob() at all. Use DSJ.ME for the job handle in the other functions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply