Page 1 of 1

how to store job start date and time and job end dateandtime

Posted: Thu Jun 01, 2006 5:19 am
by sudhakar_viswa
Hi,

After completing of my job execution,how to store the job start date and time and end date and time in to oracle.

Thanks,
sudhakar

Posted: Thu Jun 01, 2006 5:25 am
by ArndW
If you execute, from UNIX, the dsjob -report for your job this information will be listed. Alternatively you can use the DS/BASIC function such as DSGetJobInfo() to retrieve the information from inside a DataStage routine.

Posted: Thu Jun 01, 2006 7:38 am
by sudhakar_viswa
Hi Arnd,

Thanks for your reply,I have used this function as you said.But i am not getting.It is saying DSJobGetInfo is not dimensioned.

Thanks,
sudhakar

Posted: Thu Jun 01, 2006 8:03 am
by chulett
Add '$INCLUDE DSINCLUDE JOBCONTROL.H' to your routine.

Posted: Thu Jun 01, 2006 4:28 pm
by ray.wurlod
... because JOBCONTROL.H contains the DEFFUN declaration for DSGetJobInfo()

Posted: Thu Jun 01, 2006 11:31 pm
by sudhakar_viswa
Hi chulett / ray,

I did what you people said.It is not showing any errors.But,it is giving the result as -5.

And, my reqirement is whenever the job started then the start date and time has to be stored in oracle table.And,when ever the job finished then the finished date and time has to be stored in oracle table.How to achieve this.Please suggest me asap.

Thanks,
sudhakar

Posted: Thu Jun 01, 2006 11:48 pm
by Kirtikumar
-5 which u have got is for InfoType u are using is not recognised and u should use DSJ.JOBSTARTTIMESTAMP and DSJ.JOBLASTTIMESTAMP as second arg to function (or as infotype).

TO get the start time and end time u should call the function as follows:

Code: Select all

JobStartTime = DSGetJobInfo (JobHandle, DSJ.JOBSTARTTIMESTAMP) 
which gives the time when job was started.

Code: Select all

JobStartTime = DSGetJobInfo (JobHandle, DSJ.JOBLASTTIMESTAMP) 
which gives the time when the job finish time when it was executed last time.

Ensure that u get correct end time, u should ensure that the second function is executed once this is not in running status. Or else if the job is running, u will get the start time corrtect, but the end time will be that of last run.

Posted: Fri Jun 02, 2006 12:07 am
by sudhakar_viswa
Hi Kirtikumar,

Thanks for reply.My job name is ABC.And i have used the following code in routine.But it is giving -1 as result.

$INCLUDE DSINCLUDE JOBCONTROL.H
JobStartTime=DSGetJobInfo(ABC,DSJ.JOBSTARTTIMESTAMP)
Ans=JobStartTime

Let me know what i have to write in jobhandle.

Thanks,
sudhakar

Posted: Fri Jun 02, 2006 12:12 am
by Kirtikumar
sudhakar_viswa wrote:Hi Kirtikumar,
$INCLUDE DSINCLUDE JOBCONTROL.H
JobStartTime=DSGetJobInfo(ABC,DSJ.JOBSTARTTIMESTAMP)
Ans=JobStartTime
Very first thing - in the routine, job name for which u r calling the DSGetJobInfo, job handler needs to created. So the code should be :

Code: Select all

Handle = DSAttachJob(ABS, DSJ.ERRFATAL)
JobStartTime = DSGetJobInfo (Handle, DSJ.JOBSTARTTIMESTAMP)
Nothing = DSDetachJob(Handle)
The routine always work on job handles and now on job names. See the Basic.pdf which is manual on DS basic language and functions for more help on DSAttach and DSDetach job and job handlers.

Posted: Fri Jun 02, 2006 12:12 am
by balajisr
sudhakar_viswa wrote:Hi Kirtikumar,

Thanks for reply.My job name is ABC.And i have used the following code in routine.But it is giving -1 as result.

$INCLUDE DSINCLUDE JOBCONTROL.H
JobStartTime=DSGetJobInfo(ABC,DSJ.JOBSTARTTIMESTAMP)
Ans=JobStartTime

Let me know what i have to write in jobhandle.

Thanks,
sudhakar
You should using Job handle in DSGetJobInfo and not the job name.

JobHandle is derived from DSAttachJob Function.

Posted: Fri Jun 02, 2006 12:45 am
by sudhakar_viswa
Hi kirtikumar / balajisr

I have written as following.But,i am getting result as -1

$INCLUDE DSINCLUDE JOBCONTROL.H
JobHandle=DSAttachJob(ABC,DSJ.ERRFATAL)
JobStartTime=DSGetJobInfo(JobHandle,DSJ.JOBSTARTTIMESTAMP)
Ans=JobStartTime
NOTHING=DSDetachJob(JobHandle)

Reply me asap.

Thanks,
sudhakar

Posted: Fri Jun 02, 2006 1:25 am
by sudhakar_viswa
Hi kirtikumar/balajisr/ray/chulett/Arndw,

Thank you very much.I got it.The job name should be enclosed with in codes.

Thanks,
sudhakar