Find the "Last_Run_Time" and insert it in a table

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
Amit_111
Participant
Posts: 134
Joined: Sat Mar 24, 2007 11:37 am

Find the "Last_Run_Time" and insert it in a table

Post by Amit_111 »

Hi All,

My requirement is to find the Start time, End time of a job and then insert it in an oracle table.
Please can any one help me to know the different options i can try on because even if i take the start time through a Basic function how will i pass that value to insert it in a Database?
Also one more thing...Can I execute a Oracle script through an after job routine?
Thanks in Advance.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Find the run times by invoking DSGetJobInfo() or equivalent DSMacros. You can do this in a Transformer stage triggered by, say, a SELECT against the DUAL table.

The answer to your second question is yes, but not directly - after all, an Oracle script is not a DataStage after-job subroutine. The after-job subroutine has to invoke the Oracle script appropriately, either via sqlplus or through BCI 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.
Amit_111
Participant
Posts: 134
Joined: Sat Mar 24, 2007 11:37 am

Post by Amit_111 »

Actually I have a Job which is currently executing and immediately once it finishes I want to get its start time and End time and insert it in a table....The start time i can get but the end time will be given only after the job is finished. I am not able to get this end time...
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Post by sachin1 »

one doubt i have is that do you want to track information even your job fails or their is some error...............as solution differs in that case as you need to track your job first for successful completion
Amit_111
Participant
Posts: 134
Joined: Sat Mar 24, 2007 11:37 am

Post by Amit_111 »

I want to insert the end_time irrespective of the job is a success or is aborted.
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Post by sachin1 »

you create a custom routine(after job subroutine), in routine use the DSGetJobInfo Function and get the value for DSJ.JOBSTARTTIMESTAMP infotype (this is the start time of your job) and get one value like JobEndTime = DSRTimestamp() in routine which is the end time of your job, then use DSExecute Function to insert value in database.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Note that there is also an InfoType of DSJ.JOBLASTTIMESTAMP to get the time the job finished.
-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 »

What's the value of DSJ.JOBLASTTIMESTAMP in an after-job 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 »

Trick question. :wink:

Never said you could use it 'after job', just that it exists as an InfoType. What's the value of any attempt to find out when a job finished before it actually finishes?
-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 »

For someone sufficiently pedantic, the correct answer is 11.
:o
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 »

Search for EtlStats.
Mamu Kim
Post Reply