Auto-Purge Not working

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
anupam
Participant
Posts: 172
Joined: Fri Apr 04, 2003 10:51 pm
Location: India

Auto-Purge Not working

Post by anupam »

In our Datastage Production Box, auto purge is not working at all. From Datastage administrator, we have set "Auto-purge of job log" option for Over 5 Days. But when we look the log entries in the jobs, we can see logs for more than a year also.

When we try to set the auto-purge option from director, then also it is not setting the auto-purge option for more then 5 Days.

It is always Immidiate Purge and what ever we do it is not at all setting the default to auto-purge.

Because of this, we have to continuously clear the log entries for every Job manually. Is there any way for clearing the Logs entries prior to 5 days automatically without stopping the Applications/Jobs.

Please suggest.
----------------
Rgds,
Anupam
----------------
The future is not something we enter. The future is something we create.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I've seen behaviour like this before, it was a bug in the client from what I recall. :?

What happens if you try to set it to auto-purge after x number of job runs, instead of days? Does that stick?
-craig

"You can never have too many knives" -- Logan Nine Fingers
anupam
Participant
Posts: 172
Joined: Fri Apr 04, 2003 10:51 pm
Location: India

Post by anupam »

auto-purge after x number of job runs
is also not working.

That is the reason for clearing the Logs of each and every Job manually.

If it is a known bug, then may be there should be some work around also.

I have seen couple of routines given in the forum but that doesn't apply to our requirement. We want to clear the Log Entries prior to 5 Days at any point of time irrespective of the fact that the job is running at that point of time or not. I don't want to lock that Job or Log.



[/b]
----------------
Rgds,
Anupam
----------------
The future is not something we enter. The future is something we create.
denzilsyb
Participant
Posts: 186
Joined: Mon Sep 22, 2003 7:38 am
Location: South Africa
Contact:

Post by denzilsyb »

hallo..

when did you set the "auto purge" in administrator? The key here is to set the auto purge before you import your project. That means projects will get the default settings from the administrator.

If you set auto purge after importing your project, only new jobs will purge after five days. If this is the case, I would create a new project, set the defaults and then import the dsx to the new project.
dnzl
"what the thinker thinks, the prover proves" - Robert Anton Wilson
anupam
Participant
Posts: 172
Joined: Fri Apr 04, 2003 10:51 pm
Location: India

Post by anupam »

Yes, I am aware of the fact that setting the auto-purge at project level is applicable only to the applications/Jobs which are promoted after this change.

But if i am trying to set the auto-purge option from director for each and every job separately(Promoted prior to the changes done in datastage administrator for auto-purge), that is not working, I think this should work.

And if it is not working then that means there is no option left then to create a new project and take a export import and then set the auto-purge globally for the whole project.

The other alternative may be to write a routine which will clear all the log entries, Now with this option, i need to lockk the Job and Log which i do not want to as i don't want to stop the running application for clearing the Logs.
----------------
Rgds,
Anupam
----------------
The future is not something we enter. The future is something we create.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The only reason I asked about the number of runs option was, in my case, it would take while the other would not. If I set that particular option first, then for some reason I could change it from runs to days and that would also stick... but I couldn't set it directly. :?

I've got a utility that will set the auto-purge on job logs in a project across the board. Be glad to post that here later today when I get into the office.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Courtesy of KBA:

Code: Select all

      TCL = 'SSELECT DS_JOBS'
      If JobNameSubstringMatch Then TCL:= ' LIKE "...':JobNameSubstringMatch:'..."'
      If Folder Then TCL:= ' WITH F3 = "':Folder:'"'
      Call DSExecute("TCL", TCL, ScreenOutput, SystemReturnCode)
      Call DSLogInfo("TCL Output for: ":TCL:"  >> ":ScreenOutput, "Msg")

      OPEN "DS_JOBS" TO JobsXrefTable Else
         Call DSLogFatal("Unable to open DS_JOBS", "Msg")
      End

      JobList = ""
      AllJobsDone = @FALSE
      Loop
         Readnext JobName Else AllJobsDone = @TRUE
      Until AllJobsDone Do
         If LEFT(JobName,2) # "\\" Then
            Read Row From JobsXrefTable, JobName Then
               JobList<-1> = JobName:"|":Row<5>
            End
         End
      Repeat

      Call DSLogInfo("Processing the following jobs: ":JobList, "Msg")

      JobCount = Dcount(JobList,@AM)
      For Job = 1 TO JobCount
         JobName = FIELD(JobList<Job>, "|",1)
         TableName = "RT_LOG":FIELD(JobList<Job>, "|",2)
         OPEN TableName TO F.FILE Then
            Read PurgeSettings FROM F.FILE, "//PURGE.SETTINGS" Else PurgeSettings = ""
*            Call DSLogInfo(JobName:" before ":@AM:PurgeSettings, "Msg")
            If PurgeType = "DAY" Then
               PurgeSettings<1> = 1
               PurgeSettings<2> = PurgeInterval
               PurgeSettings<3> = 0
            End
            If PurgeType = "RUN" Then
               PurgeSettings<1> = 2
               PurgeSettings<2> = 0
               PurgeSettings<3> = PurgeInterval
            End
*            Call DSLogInfo(JobName:" after: ":@AM:PurgeSettings, "Msg")
            WRITE PurgeSettings ON F.FILE, "//PURGE.SETTINGS"
         End
      Next Job
It is job control code that is expecting four parameters:

Folder (optional)
JobNameSubstringMatch (optional)
PurgeType (RUN or DAY)
PurgeInterval (#)
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply