auto clear log

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

clj242021
Participant
Posts: 33
Joined: Mon Feb 12, 2007 2:54 am

auto clear log

Post by clj242021 »

everybody who know auto clear the specify job's log use shell script
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Stick to the auto-purge property.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
clj242021
Participant
Posts: 33
Joined: Mon Feb 12, 2007 2:54 am

Post 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
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Also keep in mind, the coded methodology might not exist in the next version.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
oacvb
Participant
Posts: 128
Joined: Wed Feb 18, 2004 5:33 am

Post 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?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Search for ways to clear the &PH& folder.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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:
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
clj242021
Participant
Posts: 33
Joined: Mon Feb 12, 2007 2:54 am

Post 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;
clj242021
Participant
Posts: 33
Joined: Mon Feb 12, 2007 2:54 am

Post 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;
clj242021
Participant
Posts: 33
Joined: Mon Feb 12, 2007 2:54 am

Post 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&"
Post Reply