Show TOC

Background documentationAutomatically Deleting Old Job Definitions Locate this document in the navigation structure

 

The keep clause of a job definition can automate job deletion. The author of the job definition can set the keep clause to the desired number of jobs or the maximum age of jobs. If the number of jobs is set, this number can be counted per job owner, per key or overall for the system.

If you alter the keep clause of an existing job definition with existing jobs, then the conditions under which the existing jobs are kept is changed as well.

Changing the keep clause on a job definition that has many finished executions therefore results in massive work for the system. For example, when you run one million jobs of the same script without a keep clause and then set it to keep 10 per system, all one million finished jobs but 10 will be deleted.

Job Deletion

Jobs are not deleted immediately, but deleted by system jobs that run according to a submit frame every 15 minutes, by default. The job information in the central server is deleted by System_ProcessKeepClauses jobs, the output files are removed by System_DeleteJobFiles jobs. These are maintenance jobs that run in the background and are not displayed in the default All (non-maintenance) jobs job filter. If you need to monitor these jobs, you need touse the Maintenance (background) jobs job filter.

These job definitions run according to the built-in submit frames System_ProcessKeepClausesSubmitFrame and System_DeleteJobFilesSubmitFrame, you can change them to modify the intervall at which the jobs run.

Maximum Age of Jobs

If you set a maximum age for a job, the system will fill in an expiration time stamp for the job when the job finishes. For example, if the keep clause is 1 day and the job finishes on 12 October at 11:02, then the expiration time stamp is set to 13 October at 11:02. When you edit the keep clause on the job definition, the changes affect all jobs of the job definition almost immediately.

Maximum Number of Jobs

If you set a maximum number of finished jobs, the system will keep track of the numbers of jobs per script. If you specify a number for the entire system, then an overall count is calculated and compared against the maximum. If you specify a number per user, then only the jobs ran for the user are compared to the set value. If you specify a number per key field, then the jobs with the same values for the parameters that are part of the primary key are considered. For example, if you run a job with a particular parameter P_COMPANY_ID which is set to be a key parameter, and the keep clause is 1 per key, then a run with P_COMPANY_ID set to 1 will not be deleted until another run with P_COMPANY_ID set to 1 is finished.