Page 1 of 2

auto clear log

Posted: Thu Mar 08, 2007 1:56 am
by clj242021
everybody who know auto clear the specify job's log use shell script

Posted: Thu Mar 08, 2007 3:09 am
by kumar_s

Posted: Thu Mar 08, 2007 3:11 am
by kumar_s
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.

Posted: Thu Mar 08, 2007 10:28 am
by DSguru2B
Stick to the auto-purge property.

Posted: Thu Mar 08, 2007 9:06 pm
by clj242021
thanks for all reply
I serach author whith key "Ray or Kim " it can't find anthing
can you post the code?

thanks

Posted: Thu Mar 08, 2007 9:12 pm
by kumar_s
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.

Posted: Thu Mar 08, 2007 10:00 pm
by DSguru2B
Also keep in mind, the coded methodology might not exist in the next version.

Posted: Thu Mar 08, 2007 10:04 pm
by oacvb
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?

Posted: Thu Mar 08, 2007 10:05 pm
by DSguru2B
Search for ways to clear the &PH& folder.

Posted: Thu Mar 08, 2007 10:08 pm
by kumar_s
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 are referring to Multiple instance jobs, better do a compile rather than tweaking around with RT_STATSnnn file.

Posted: Thu Mar 08, 2007 10:18 pm
by kumar_s
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:

Posted: Fri Mar 09, 2007 7:10 am
by kduke
Ken Bland posted the code to set all of the purge settings for all jobs. This code is to clear mutiple instances on a single job.

Posted: Sun Mar 18, 2007 10:07 am
by clj242021
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;

Posted: Sun Mar 18, 2007 10:08 am
by clj242021
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?
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;

Posted: Sun Mar 18, 2007 10:11 am
by clj242021
DSguru2B wrote:Search for ways to clear the &PH& folder.
If you want to clear &PH& folder,you can via DS administrator--->project-->command and run command "clear.file &PH&"