job's previous run time

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
harryhome
Participant
Posts: 112
Joined: Wed Oct 18, 2006 7:10 am

job's previous run time

Post by harryhome »

Hi

I m designing a job where i wann fetch the source data if its got updated after last run of the same job.

hence i m looking for the last run's timestamp, so can i get last's runtime of same job in current run?

plz guide
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You should do this checking in a sequence. You can write your own routine using the following logic:

- call DSAttachJob() to attach to the job
- call the routine DSGetJobInfo() with DSJ.JOBLASTTIMESTAMP
- call DSExecute() to return the file date/timestamp
- compare
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If you are calling it from dsjob function, you can as well use

Code: Select all

dsjob -jobinfo $Project $Job | grep 'Last Run Time'
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

If you want the timestamp in YYYY-MM-DD hh:nn:ss format then run the following

Code: Select all

dsjob -report <<PROJECTNAME>> <<JobName>> | grep -w "Job end time" | awk -F"\=" '{print $2}'
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Because you're doing this in a job sequence before the job starts, you can simply request the job start timestamp in a Routine activity.

Code: Select all

FUNCTION GetJobStart(TheJobName)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
hJob = DSAttachJob(TheJobName, DSJ.ERRNONE)
Ans = DSGetJobInfo(hJob, DSJ.JOBSTARTTIMESTAMP)
If Ans = DSJE.BADHANDLE Then Ans = @NULL
ErrCode = DSDetachJob(hJob)
RETURN(Ans)
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