Windows -- Audit Table

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Jaydev
Participant
Posts: 13
Joined: Thu Nov 01, 2012 6:28 am
Location: Hyderabad
Contact:

Windows -- Audit Table

Post 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.
Regards,
Jay
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Download ETLstats from Kim Duke's web site for free. All the work's already been done for you.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Windows -- Audit Table

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Jaydev
Participant
Posts: 13
Joined: Thu Nov 01, 2012 6:28 am
Location: Hyderabad
Contact:

Post 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")
Regards,
Jay
prasannakumarkk
Participant
Posts: 117
Joined: Wed Feb 06, 2013 9:24 am
Location: Chennai,TN, India

Post 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.
Thanks,
Prasanna
Jaydev
Participant
Posts: 13
Joined: Thu Nov 01, 2012 6:28 am
Location: Hyderabad
Contact:

Post 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.
Regards,
Jay
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Probably the fact that 'after job' the job hasn't actually ended yet. It's still running until everything After Job finishes.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Jaydev
Participant
Posts: 13
Joined: Thu Nov 01, 2012 6:28 am
Location: Hyderabad
Contact:

Post by Jaydev »

Thanks Chulette. It is the reason why i am not getting end stamp.

Marking my post as resolved.
Regards,
Jay
Post Reply