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

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
sudhakar_viswa
Participant
Posts: 85
Joined: Fri Nov 18, 2005 5:35 am

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

Post 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
i need to know datastage
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
sudhakar_viswa
Participant
Posts: 85
Joined: Fri Nov 18, 2005 5:35 am

Post 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
i need to know datastage
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Add '$INCLUDE DSINCLUDE JOBCONTROL.H' to your routine.
-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 »

... because JOBCONTROL.H contains the DEFFUN declaration for DSGetJobInfo()
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sudhakar_viswa
Participant
Posts: 85
Joined: Fri Nov 18, 2005 5:35 am

Post 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
i need to know datastage
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post 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.
Regards,
S. Kirtikumar.
sudhakar_viswa
Participant
Posts: 85
Joined: Fri Nov 18, 2005 5:35 am

Post 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
i need to know datastage
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post 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.
Regards,
S. Kirtikumar.
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post 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.
sudhakar_viswa
Participant
Posts: 85
Joined: Fri Nov 18, 2005 5:35 am

Post 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
i need to know datastage
sudhakar_viswa
Participant
Posts: 85
Joined: Fri Nov 18, 2005 5:35 am

Post 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
i need to know datastage
Post Reply