Page 1 of 1

Windows -- Audit Table

Posted: Tue Apr 02, 2013 11:35 pm
by Jaydev
Hi,

I need to capture Audit info like job start time, end time, no. of rows processed etc into a table.

My plan is to write a routine which will write all the stats to a sequential file and then I am planning to read that file and update database..

I want to know if i can achieve all the above in any other way..like can i get through a bat script?? If not, can any one tell how can i make routine to write info in a readable format.

I am new to routines as well as bat scripts.Please note that environment is Windows.

Posted: Wed Apr 03, 2013 2:56 am
by ray.wurlod
Download ETLstats from Kim Duke's web site for free. All the work's already been done for you.

Re: Windows -- Audit Table

Posted: Wed Apr 03, 2013 7:01 am
by chulett
Jaydev wrote:I am new to routines as well as bat scripts.
That will complicate your effort but this should be a great learning experience.

Posted: Tue Apr 09, 2013 3:44 am
by Jaydev
Hi Ray, Thanks for your reply, but I couldnt download stats due to restrictive environment I am in.

HiChulett, Thanks for suggestion and I started learning routines.

For the same topic which I posted, I am facing below error when compiling the routine.

Can any one look in to it and tell why I am facing this Variable 'Ans' issue which I never declared in code.

Compiling: Source = 'DSU_BP/DSU.DSSTATISTICS', Object = 'DSU_BP.O/DSU.DSSTATISTICS'
************************************************
WARNING: Variable 'Ans' never assigned a value.

Code is as below which will write stats to job logs. can any one also say how can I write it to a text file which can be readable by a DS job.

Thanks All.

$INCLUDE DSINCLUDE JOBCONTROL.H
JobHandle = DSJ.ME
JobName = DSGetJobInfo(JobHandle,DSJ.JOBNAME)
JobStarted = convert(" :-","_",DSGetJobInfo(JobHandle,DSJ.JOBSTARTTIMESTAMP))
JobEnd = convert(" :-","_",DSGetJobInfo(JobHandle,DSJ.JOBLASTTIMESTAMP))
call DSLogInfo("Job Name: ":JobName,"Job")
call DSLogInfo("Job Start TimeStamp : ":JobStarted, "Job")
call DSLogInfo("Job End TimeStamp : ":JobEnd, "Job")

Posted: Tue Apr 09, 2013 5:19 am
by prasannakumarkk
Ans is where the routine return values are stored. You can store the status of the routine or pass any value to job. It must be assigned with value.

Posted: Tue Apr 09, 2013 6:39 am
by Jaydev
Hi Prasanna,

Thanks for pointing out., 'Ans' is a default variable expecting some return value. I gave Ans=0 in code and it compiled successfully.

I ran this as an After job routine and could see results in logfiles.

But I couldnt see END Timestamp. I searched in forum, and syntax looks correct. Any idea why it is not returning value. Currently it is blank, I made change by giving only one 'T' in 'LASTTIMESTAMP', it is giving '5' which means what i changed is wrong.

So what is wrong in below statement and how will it populate correct value.

JobEnd = convert(" :-","_",DSGetJobInfo(JobHandle,DSJ.JOBLASTTIMESTAMP))


Thanks.

Posted: Tue Apr 09, 2013 7:08 am
by chulett
Probably the fact that 'after job' the job hasn't actually ended yet. It's still running until everything After Job finishes.

Posted: Fri Apr 19, 2013 3:51 am
by Jaydev
Thanks Chulette. It is the reason why i am not getting end stamp.

Marking my post as resolved.