Fetch job Stats

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
jayantthakore
Participant
Posts: 42
Joined: Tue Jan 18, 2005 5:48 am

Fetch job Stats

Post by jayantthakore »

Hii,

I need to fetch the job Start time,Job Termination Time and Number of times job ran into a db2 Table.
Can anyone tell me how to do that ??

Thanks
regards,
Jayant S Thakore
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Do a search on EtlStats.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What precisely do you mean by "number of times job ran". If there's a single termination time then surely this figure is always 1?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jayantthakore
Participant
Posts: 42
Joined: Tue Jan 18, 2005 5:48 am

Post by jayantthakore »

Ray,

I have figured that thing out.....
Sorry to confuse you.
You can skip the third part .
Can you tell me how to get the Start time & Termination Time ??
regards,
Jayant S Thakore
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Kim has mentioned one way. You can get that from his signature link.
There are some other option from DSGetJobInfo funciton in datstage.
DSJ.JOBELAPSED
DSJ.JOBLASTTIMESTAMP
DSJ.JOBSTARTTIMESTAMP
You can also leverage the
dsjob -log
-logsum
-logdetail options for it.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Most of what I have in EtlStats is using dsjob -report XML. I can also retrieve old job runs by reading the job log directly. There is no other way to get an old run. The API only deals with the last run. There is a last run for every job instance though. If you autopurge your logs then that option is gone.
Mamu Kim
ersunnys
Participant
Posts: 29
Joined: Wed Sep 13, 2006 1:39 pm
Location: Singapore

Post by ersunnys »

kduke wrote:Most of what I have in EtlStats is using dsjob -report XML. I can also retrieve old job runs by reading the job log directly. There is no other way to get an old run. The API only deals with the last run. There is a last run for every job instance though. If you autopurge your logs then that option is gone.
can you please explain me the syntax of executing the 'dsjob -report' let my project name is abc, my host name is yyy, my userid is user and password is pass... i m new to datastage and do not know much... so it will be a great help if you can help me...

Thx

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

Post by ray.wurlod »

Welcome aboard. :D

You can find the dsjob command documented in the Server Job Developer's Guide or the Parallel Job Advanced Developer's Guide

If you're on the DataStage server machine, you can use

Code: Select all

dsjob -report projectname jobname
If you want to execute from somewhere else it's

Code: Select all

dsjob -host yyy -user user -password pass -report projectname jobname
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

EtlStats has a job named DSJobReportDb. It is in a folder called EtlStats\ETL_Row_Counts. It has a before job ExecDOS command:

Code: Select all

#dsjobcmd# #projName# #jobName# XML >KimD\#jobName#.xml
Where in DOS

dsjobcmd="..\..\Engine\bin\dsjob -report"

If you have UNIX then this needs to change to a ExecSH command and

dsjobcmd="../DSEngine/bin/dsjob -report"

So Ray's syntax is the same except XML is added to the end of the dsjob command.

This job is executed by 2 other jobs DSJobReportDbDriverNoWait which executes DSJobReportDbDriver which executes DSJobReportDb. DSJobReportDbDriverNoWait should be the last step in your sequence. You can copy this last step out of SeqPrepareEtlStats. This sequence should setup all the metadata needed to run EtlStats after each sequence and email you the row counts of successful jobs or logs of all failed jobs. You have source code on all jobs and routines in this DSX.
Mamu Kim
Post Reply