Page 1 of 1

List jobs by auto purge setting

Posted: Sun Jan 14, 2007 4:52 pm
by ecclesr
I have been searching fo command/api script that will allow me to list all the job in a project grouped by their auto purge setting.

I intend soon to resetting the default auto purge for production project.

The auto purge setting will be set for x days ( x being the number of days required for our daily jobs) I will over ride the auto purge setting for those jobs that are not daily to number of entries depending on if weekly, monthly etc.

Having a command/api script to list jobs - group by their purge setting would be handy for monitoring

I have so far been unable to find the required code in a the forum

Any pointers/advice on this matter would be appreciated

Thanking you all in advance

Posted: Sun Jan 14, 2007 5:37 pm
by kcbland
On my members page on my website is a utility job (.dsx file) for mass-changing the default log purge setting on jobs. You can take that utility and add any logic you desire to build the output you want. It's just a DS BASIC Batch job. You can use Director or Designer to edit and compile the job.


If you don't want to get on my site, you can construct the job with the following logic. In a Batch job, setup 4 parameters: JobNameSubstringMatch, Folder, PurgeType, PurgeInterval. This logic will mass apply to jobs that have the partial substring match, limited to an optional category/folder, setting the purge type and interval.

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

Posted: Sun Jan 14, 2007 6:22 pm
by ecclesr
Thank you Kenneth

Exactly what I was looking for - I am a member of your site so I will take a look