Page 1 of 1

Execute comand statistics

Posted: Sun Oct 01, 2006 4:55 pm
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

Re: Execute comand statistics

Posted: Sun Oct 01, 2006 7:14 pm
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

Posted: Sun Oct 01, 2006 10:11 pm
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)