Job Related Information

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ORACLE_1
Premium Member
Premium Member
Posts: 35
Joined: Mon Feb 16, 2009 1:19 pm

Job Related Information

Post 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 !!
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
ORACLE_1
Premium Member
Premium Member
Posts: 35
Joined: Mon Feb 16, 2009 1:19 pm

Post 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 !!
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I should not hang. Maybe if the job is locked. Never checked for that.
Mamu Kim
ORACLE_1
Premium Member
Premium Member
Posts: 35
Joined: Mon Feb 16, 2009 1:19 pm

Post 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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

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

Post by chulett »

Where's your detach of the handle?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ORACLE_1
Premium Member
Premium Member
Posts: 35
Joined: Mon Feb 16, 2009 1:19 pm

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

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

"You can never have too many knives" -- Logan Nine Fingers
ORACLE_1
Premium Member
Premium Member
Posts: 35
Joined: Mon Feb 16, 2009 1:19 pm

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

Post by chulett »

Yup!
-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 »

EOTCOUNT is not the same as rowcount.
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 »

Huh... hadn't noticed that, what pray tell does that one do?
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

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