auto clear log
Moderators: chulett, rschirm, roy
auto clear log
everybody who know auto clear the specify job's log use shell script
By the way, why you need it, if Auto Purging from Datastage is possible? You can acheive this by setting appropriate value in Adminstrator or in Director.
If you need to write a script, you need to take care of Auto Purge entry. There are codes posted by Ray and Kim. Search for that.
If you need to write a script, you need to take care of Auto Purge entry. There are codes posted by Ray and Kim. Search for that.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Its not Ray or Kim but its "Ray.Wurlod" and 'Kduke". You can find these names in first page under All time contributers.
Btw: What makes you to still to follow up for the code and not the auto purge mechanism.
Btw: What makes you to still to follow up for the code and not the auto purge mechanism.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
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?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Or use Kim's code at you Risk.
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:
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
1. Log into the server using the dsadm user;
2. Run "cd `cat /.dshome`" to cd to DSEngine directory;
3. Run " . ./dsenv" to source the dsenv file
4. Run "bin/uvsh to get into DataStage prompt;
5. At ">" DataStage engine prompt, run "LOGTO project_name"; #note the
project name is case sensitive;
6. At ">" DataStage engine prompt,run "DS.TOOLS" You then get DataStage Tools Menu
7. "select # 4" You then get DataStage Process and Lock Administration #note Just hit enter then display
"Press any key to return to the menu..."
8. "select # 11" You then get Clear status file for a job #note Enter job name for clear status file
9. At ">" run "LO" to quit out of DataStage Command prompt;
2. Run "cd `cat /.dshome`" to cd to DSEngine directory;
3. Run " . ./dsenv" to source the dsenv file
4. Run "bin/uvsh to get into DataStage prompt;
5. At ">" DataStage engine prompt, run "LOGTO project_name"; #note the
project name is case sensitive;
6. At ">" DataStage engine prompt,run "DS.TOOLS" You then get DataStage Tools Menu
7. "select # 4" You then get DataStage Process and Lock Administration #note Just hit enter then display
"Press any key to return to the menu..."
8. "select # 11" You then get Clear status file for a job #note Enter job name for clear status file
9. At ">" run "LO" to quit out of DataStage Command prompt;
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?
2. Run "cd `cat /.dshome`" to cd to DSEngine directory;
3. Run " . ./dsenv" to source the dsenv file
4. Run "bin/uvsh to get into DataStage prompt;
5. At ">" DataStage engine prompt, run "LOGTO project_name"; #note the
project name is case sensitive;
6. At ">" DataStage engine prompt,run "DS.TOOLS" You then get DataStage Tools Menu
7. "select # 4" You then get DataStage Process and Lock Administration #note Just hit enter then display
"Press any key to return to the menu..."
8. "select # 11" You then get Clear status file for a job #note Enter job name for clear status file
9. At ">" run "LO" to quit out of DataStage Command prompt;