Page 1 of 1

Job Related Information

Posted: Wed Aug 11, 2010 12:44 pm
by ORACLE_1
Hey Gurus ,

I m trying to put some basic information about the datastage jobs in a table or file (like job name , status , job start , job end). I developed a routine which uses the job handle value in the DSgetjobinfo routine and brings this information. I call this routine from a server job which passes the job handle infromation after extracting it from DS JOBS universe table.

I have around 2000 Jobs in a Project , and everything works fine but this takes a long time and sometimes it just hangs (probably I am locking the VOC or something). Can you guys see if I am doing this correctly , if not what will be the most efficient way to do this? Thanks !!!

Cheers !!

Posted: Wed Aug 11, 2010 2:01 pm
by kduke
You need to check to see if you attaching to the current job. It does not like to detach from the current job. It will hang.

Posted: Wed Aug 11, 2010 2:39 pm
by ORACLE_1
Hey ,

I checked , I am filtering out few jobs including the one which is calling it. So that may not be the case.

Thanks !!

Posted: Thu Aug 12, 2010 10:04 am
by kduke
I should not hang. Maybe if the job is locked. Never checked for that.

Posted: Tue Aug 17, 2010 8:09 am
by ORACLE_1
Here is the code that I have in my routine , I filter out few enteries before passing the job name to this routine. This routine may not be a very good one as this is one of my initial tries. Can you guys take a look what i am doing wrong?

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

      Equate RoutineName To 'GetJobInfo'

      Deffun DSRMessage(A1, A2, A3) Calling "*DataStage*DSR_MESSAGE"

      JobHandle = ''

      JobHandle = DSAttachJob(JobName, DSJ.ERRNONE)

*      Message = DSRMessage('DSTAGE_TRX_I_0014', 'Attaching job for processing - %1 - Status of Attachment = %2', JobName:@FM:JobHandle )

*      Call DSLogInfo(Message, RoutineName)


         Int = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)

         Begin Case
            Case Int = DSJS.RUNFAILED
               Info = 'Aborted'
            Case Int = DSJS.RUNOK
               Info = 'Completed'
            Case Int = DSJS.RUNWARN
               Info = 'Warning'
            Case Int = DSJS.RUNNING
               Count = DSGetJobInfo(JobHandle, DSJ.DSJ.JOBEOTCOUNT)
               Info = 'Running' : 'Count of Rows Complete' : Count
            Case @True                   ; * all other values
               Info = 'Not Defined'
         End Case

         StartTime = DSGetJobInfo(JobHandle, DSJ.JOBSTARTTIMESTAMP)
         EndTime = DSGetJobInfo(JobHandle, DSJ.JOBLASTTIMESTAMP)

Ans = Info : '|' : StartTime : '|' : EndTime

Posted: Tue Aug 17, 2010 8:47 am
by kduke
You need to check to see if you actually attached to the job by making sure your JobHandle is valid. Also you do not need to set this to '' otherwise your code looks good.

Posted: Tue Aug 17, 2010 9:46 am
by chulett
Where's your detach of the handle?

Posted: Tue Aug 17, 2010 12:36 pm
by ORACLE_1
chulett wrote:Where's your detach of the handle?
oh I did not think of that one.. Ideally where will I do that.. in the routine right? after getting all the information??

Posted: Tue Aug 17, 2010 12:43 pm
by chulett
Yes, do that as soon as you are done with the handle, so typically just before the exit point.

:idea: And you need to not enable the 'Disable BBCode in this post' option if you want tags (like the quote tags you used) to work properly. I fixed your post, so just FYI at this point.

Posted: Tue Aug 17, 2010 12:54 pm
by ORACLE_1
chulett wrote:Yes, do that as soon as you are done with the handle, so typically just before the exit point.

:idea: And you need to not enable the 'Disable BBCode in this post' option if you want tags (like the quote tags you used) to work properly. I fixed your post, so just FYI at this point.
LOL Thanks !!

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

      Equate RoutineName To 'GetJobInfo'

      Deffun DSRMessage(A1, A2, A3) Calling "*DataStage*DSR_MESSAGE"

      JobHandle = ''

      JobHandle = DSAttachJob(JobName, DSJ.ERRNONE)

*      Message = DSRMessage('DSTAGE_TRX_I_0014', 'Attaching job for processing - %1 - Status of Attachment = %2', JobName:@FM:JobHandle )

*      Call DSLogInfo(Message, RoutineName)


         Int = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)

         Begin Case
            Case Int = DSJS.RUNFAILED
               Info = 'Aborted'
            Case Int = DSJS.RUNOK
               Info = 'Completed'
            Case Int = DSJS.RUNWARN
               Info = 'Warning'
            Case Int = DSJS.RUNNING
               Count = DSGetJobInfo(JobHandle, DSJ.DSJ.JOBEOTCOUNT)
               Info = 'Running' : 'Count of Rows Complete' : Count
            Case @True                   ; * all other values
               Info = 'Not Defined'
         End Case

         StartTime = DSGetJobInfo(JobHandle, DSJ.JOBSTARTTIMESTAMP)
         EndTime = DSGetJobInfo(JobHandle, DSJ.JOBLASTTIMESTAMP)

ErrCode = DSDetachJob(JobHandle)

Ans = Info : '|' : StartTime : '|' : EndTime
Bascially just added the DSDetachJob at the last statement... Correct??

Posted: Tue Aug 17, 2010 4:21 pm
by chulett
Yup!

Posted: Tue Aug 17, 2010 4:45 pm
by ray.wurlod
EOTCOUNT is not the same as rowcount.

Posted: Tue Aug 17, 2010 6:12 pm
by chulett
Huh... hadn't noticed that, what pray tell does that one do?

Posted: Tue Aug 17, 2010 8:26 pm
by chulett
Interesting... and only a partial answer.

Searching for 'EndOfTransmission block' even without the 'block' part only returns this post out of the bajillions here over the years, so not exactly in common use. While I could guess what an EOT block might be, I'd settle for an explanation from the Master. :wink: