auto clear log
Posted: Thu Mar 08, 2007 1:56 am
everybody who know auto clear the specify job's log use shell script
If you are referring to Multiple instance jobs, better do a compile rather than tweaking around with RT_STATSnnn file.oacvb wrote:How can i clear status file by script. I have an option in DS "Job --> Clear Status File" which clears all the instance of the job.I wanted to clear all the instances which ran one week ago? how to do that?
Code: Select all
* ------------------------------------------------------------
* EtlClearInstanceIDs
* Decription:
* This will clear instance IDs.
* USE AT YOUR OWN RISK
* ------------------------------------------------------------
* Parameters:
* 1. JobName
* ------------------------------------------------------------
* Created : 2005-10-05 Kim Greggory Duke
* Last Modified :
* ------------------------------------------------------------
* $INCLUDE DSINCLUDE JOBCONTROL.H
* ------------------------------------------------------------
Ans = ""
open 'DS_JOBS' to DsJobs else
ErrMsg = "Error: Unable to open DS_JOBS"
gosub ErrRtn
goto TheEnd
end
read JobRec from DsJobs, JobName then
JobNo = JobRec<5>
end else
ErrMsg = "Error: Unable to open DS_JOBS"
gosub ErrRtn
goto TheEnd
end
RtLogFile = 'RT_LOG': JobNo
open RtLogFile to RtLog else
ErrMsg = "Error: Unable to open ": RtLogFile
gosub ErrRtn
goto TheEnd
end
* ----------------------------------------------------------------------
* initialize variables
* ----------------------------------------------------------------------
ThisJobName = 'EtlClearInstanceIDs'
ThisDay = convert('-','',oconv(@DATE, "D4-YMD[4,2,2]"))
ThisTime = convert('-','',oconv(@TIME, "MTHS"))
* ------------------------------------------------------------
Cmd = ''
Cmd := 'Delete from '
Cmd := ' RT_STATUS': JobNo :' '
Cmd := 'where '
Cmd := ' EVAL "@RECORD<1>" = ':"'INVOCATION'"
Cmd := ';'
Call DSLogInfo("Execute: " : Cmd, ThisJobName)
execute Cmd capturing output returning RtnCode
Call DSLogInfo("Command Results: " : output, JobName)
* ------------------------------------------------------------
Cmd = ''
Cmd := 'Delete from '
Cmd := ' RT_STATUS': JobNo :' '
Cmd := 'where '
Cmd := ' EVAL "@RECORD<1>" = ':"'JOB'"
Cmd := ';'
Call DSLogInfo("Execute: " : Cmd, ThisJobName)
execute Cmd capturing output returning RtnCode
Call DSLogInfo("Command Results: " : output, JobName)
* ------------------------------------------------------------
Cmd = ''
Cmd := 'Delete from '
Cmd := ' RT_STATUS': JobNo :' '
Cmd := 'where '
Cmd := ' EVAL "@RECORD<1>" = ':"'STAGE'"
Cmd := ';'
Call DSLogInfo("Execute: " : Cmd, ThisJobName)
execute Cmd capturing output returning RtnCode
Call DSLogInfo("Command Results: " : output, JobName)
* ------------------------------------------------------------
goto TheEnd
* ------------------------------------------------------------
ErrRtn:
Call DSLogInfo(ErrMsg , "JobControl")
* Call DSLogFatal(ErrMsg, "JobControl")
* abort
return
* ------------------------------------------------------------
TheEnd:
1. Log into the server using the dsadm user;oacvb wrote:How can i clear status file by script. I have an option in DS "Job --> Clear Status File" which clears all the instance of the job.I wanted to clear all the instances which ran one week ago? how to do that?
If you want to clear &PH& folder,you can via DS administrator--->project-->command and run command "clear.file &PH&"DSguru2B wrote:Search for ways to clear the &PH& folder.