Execute comand statistics

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
vsi
Premium Member
Premium Member
Posts: 507
Joined: Wed Mar 15, 2006 1:44 pm

Execute comand statistics

Post by vsi »

Hi
I know that we have ways to capture job stats but my requirement is to capture start time and end time of an execute command.

We are using shell scripts to load data in to target so I am using Execute comand stage to call the script and now I need to update start time and end time of that particular command in to an audit table

has any one faced this type of situation , guide me pls.


Thanks
psbans
Participant
Posts: 4
Joined: Thu Feb 23, 2006 6:05 pm

Re: Execute comand statistics

Post by psbans »

you can write start and end times inside your shell script
eg:

#!/usr/bin/ksh
#######################################
# yourshellscript.sh
######################################

sqlplus -s <<EOF
test/test@test

PROMPT Insert start time into audit table


INSERT INTO AUDIT_TABLE
(STAR_TIME)
SELET SYSDATE FROM DUAL
/

COMMIT
/

#remaining script to load data into target
..
...
..
..


PROMPT Insert end time into audit table

INSERT INTO AUDIT_TABLE
(END_TIME)
SELET SYSDATE FROM DUAL
/

COMMIT
/

EOF

exit 0
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or you can use a Routine activity and use DataStage BASIC functions to capture the date and time.

Code: Select all

FUNCTION TimedExecute(ScriptPath)
Shell = (If System(91) Then "DOS" Else "UNIX")
StartTime = TimeDate()
Call DSExecute(Shell, (ScriptPath), Output, ExitStatus)
FinishTime = TimeDate()
Message = "Script " : Quote(ScriptPath) : " started " : StartTime : ", finished " : FinishTime
Call DSLogInfo(Message, "TimedExecute")
Ans = ExitStatus
RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply