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
Execute comand statistics
Moderators: chulett, rschirm, roy
Re: Execute comand statistics
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.