Page 1 of 1

Posted: Sat Mar 15, 2003 4:04 am
by ray.wurlod
If you're running in an after-job routine, end date/time can be obtained from the system functions Date() and Time(), or TimeDate().
Elapsed time can be obtained by getting the job's start date/time using DSGetJobInfo(DSJ.ME, DSJ.JOBSTARTTIMESTAMP) and subtracting.

Alternately, obtain the Control entries from the log (DSGetLogSummary function, then DSGetLogEntry function). The times you require are recorded in these.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518

Posted: Sat Mar 15, 2003 8:04 am
by ray.wurlod
Start time for DSGetLogSummary is job start time, end time is any time now in the future. This will give you the entries for the most recent run of the job.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518

Posted: Mon Mar 17, 2003 3:52 am
by azens
Hi,

You can try this function 'DSMakeJobReport'.
It generates a string describing the complete status of a valid attached job.

There are some sample codes I wrote in a routine to capture the start time, end time, elapsed time, status and status description for jobs.

**
JobHandle = DSAttachJob(JobName, DSJ.ERRNONE)
Content = DSMakeJobReport(JobHandle, 0, 'LF')

JobStart = Field(Field(Content, Char(10), 5), '=', 2)
JobEnd = Field(Field(Content, Char(10), 6), '=', 2)
JobElapsed = Field(Field(Content, Char(10), 7), '=', 2)
JobStatus = Field(Field(Field(Content, Char(10), 8), '=', 2), ' ', 1)
JobDesc = Field(Field(Field(Content, Char(10), 8), '(', 2), ')', 1)

**

Try it, it works.

regards,
Azens


Azens Chang
MetaEdge Corp.

Posted: Mon Mar 17, 2003 6:01 am
by ray.wurlod
DSMakeJobReport was introduced in DataStage 5.0. If you're running an earlier release this is not available to you.

That said, it is not a bad suggestion! [8D]

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518

Posted: Tue Apr 15, 2003 9:34 am
by datastagedummy
Here is the piece of code that I use hope it helps

vJobBatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
vJobName = rpt$[(Index(rpt$,"STATUS REPORT FOR JOB:",1)+22),Index(rpt
$,"Generated:",1)-(Index(rpt$,"STATUS REPORT FOR JOB:",1)+23)]

vTimeStamp = rpt$[Index(rpt$,"Generated:",1)+11, 19]
vStartTime = rpt$[Index(rpt$,"Job start time=",1)+15, 19]
vEndTime = rpt$[Index(rpt$,"Job end time=",1)+13, 19]
vJobStat = rpt$[Index(rpt$,"Job status=",1)+11, 2]

Posted: Tue Apr 15, 2003 9:38 am
by datastagedummy
I am sorry I forgot the first step

rpt$ = Iconv(DSMakeJobReport(hJob,0,"LF"),"MCP")

where hJob is the job handle obtained by DSAttachJob() function

Posted: Tue Apr 22, 2003 1:38 am
by ray.wurlod
There's no direct CLI equivalent for DSMakeJobReport. The -jobinfo option comes closest, but will not provide all the information you seek. If you can identify the job number, then you could inspect the date/time modified of the job's status table (RT_STATUSxx) or log table (RT_LOGxx), which will be very close to the job finish time.

Posted: Tue Apr 22, 2003 5:09 pm
by ray.wurlod
Not easily.
The metadata for these tables refers only to the key column (@ID), so that accessing any other column, collection or other structure within the table (remember that it's not first normal form) requires certain knowledge - and understanding - about the record layouts (which varies for different record types). This information is not in the public domain.
Similarly access from the operating system command prompt can not be achieved directly (they are database tables, after all). However, they are implemented as operating system objects, so you should be able to use something like attrib to determine the date/time modified (which was my suggestion).
Decoding job name to job number is done in the DS_JOBS table. Again this can only be indirectly be accessed from the operating system.

Also check out the options in dsjob for finding the most recent event in the job log, the timestamp in which should be the job finish time.