DB2 Server for VSE & VM: Control Center Operations Guide for VM


Chapter 10. Job Scheduling Tool


Overview

The Job Scheduling tool is an integrated and flexible tool for scheduling the automatic execution of other Control Center tools. One-time activities such as adding a dbextent can be scheduled to execute once at a specified date and time; repetitive activities such as performing an archive can be scheduled to execute on a routine basis. Jobs can be executed sequentially, where each job is dependent on the completion of the previous (single-threaded execution), or concurrently as independent activities (multiple threaded execution).

Job control features include defining job priority; execution dependencies on database availability, support machine or service machine availability, and completion of other jobs; and a time window for job execution to begin and complete within.

Additionally, "no-process" days can be defined for your installation, such as local holidays or when your site is shut down. The product avoids scheduling jobs on these days and automatically reschedules them to execute on a specified earlier or later day.


How You Might Use the Job Scheduling Tool

As an example of how you might use the Job Scheduling tool, consider the time and work involved to manually initiate each tool to perform a full database archive, immediately followed by several DBSPACE reorganizations when the database returns to multiple user mode, followed by a log archive when all reorganizations complete. Compound this effort by the number of times you want to repeat the process. Once every month? Once every week? Using the Job Scheduling tool you can establish a thread of inter-dependent jobs to complete the same process, from start to finish, automatically. Furthermore, you can schedule the process to run repeatedly, such as every five days, and optionally during off-shift hours.
Advanced Usage:Although it is beyond the scope of this chapter, the Job Scheduling tool can also be used to schedule non-Control Center tools, such as your own internally developed tools, to execute on a Control Center support machine. See Appendix D, Master Scheduling Tool.


Before You Begin

If you plan on scheduling the execution of Database Administration tools, you should:


Who Can Use the Job Scheduling Tools

Use of the Job Scheduling tool and Job Schedule List tool requires Control Center DBA authority or greater.


How Job Scheduling Works

The Job Scheduling tool itself runs on the Control Center service machine. It is here that the product maintains all job schedules, control files, and execution history files; performs job analysis; and initiates job processing, regardless of where the tool will actually execute. The product initiates System Administration tools to execute directly on the target database machine and Database Administration tools to execute on a specified Control Center support machine.
Note:

  • Database Administration tools must not be scheduled to execute on the service machine where they will adversely impact the product's ability to communicate with the database machines it manages. These tools should be scheduled to run on a Control Center support machine. Refer to Table 2 for a list of tools.
  • System Administration Tools should always be scheduled to execute on the Control Center service machine. Refer to Table 1 for a list of tools.

The product will notify you when a job executes, if it fails, and if it does not execute within its defined execution window (discussed later). It also keeps a running history of each job execution start time, stop time, and result (success or failure). Between the time a job is initiated and completes on its own, whether successfully or not, the product is largely unaware of the executing tool. For example, if a job running on a support machine were interrupted by some means, the product would be unaware that the job is no longer active. In fact, until specifically told otherwise, it will show the job status as being active. We discuss how to resolve this problem and others later in this chapter.

Most job output is saved on the machine where the job executes and can be listed, viewed, modified, and deleted using the Job Schedule List tool. Output is automatically purged after the number of days specified during the product installation process.

Note:

Job output from the DBSPACE Reorganization Driver and the Reorganization Index Tool is sent to the Control Center service machine and NOT saved.

Further discussions on how Job Scheduling works is provided in the following section and in Job Scheduling Architecture.


Job Scheduling Concepts

This section discusses the basic concepts of Job Scheduling, providing you with enough information to get you started using the job scheduling tool. Later in this chapter we discuss the Job Scheduling Architecture.

Job Dependencies

The Job Scheduling tool allows you to define various dependencies for each job which must be met prior to the job being automatically initiated by the product. Typically, a job will be dependent on the availability of the target database manager, either up, running in multiple user mode or down, available to execute a single user mode tool. This will assure that the job is not initiated at a time when the database is unable to process it successfully.

Complex and time-consuming tasks which require several sequentially executed jobs can be automated by defining the execution of each job to be dependent on the completion of the previous. For example, you can schedule a database archive, followed by a reorganization, followed by another archive to execute as a single thread. See Figure 42.

Figure 42. Dependent Job Example


View figure.

Additionally, you can make one job dependent on the completion status (success or failure) of a previous job, allowing even more complex tasks to be scheduled for automatic execution.

Other job dependencies which effectively control if and when a job is initiated are discussed in the following topics of this section.

Schedule Interval

Repetitive activities such as performing an archive can be scheduled to execute on a routine basis by specifying the time between events. We refer to this as the schedule interval.

For example, to schedule a full archive of your production database to occur once a week, you would first specify the date and time of the initial execution. Next, you would specify a schedule interval of "1 week". After the initial successful job execution and every one thereafter, the product will automatically reschedule the job to execute in "1 week".

The example below shows the execution dates of four jobs, all initiated on March 1st, 1997, but each with a different schedule interval. We discuss the product's handling of the March 5th holiday next.

Figure 43. Schedule Interval Examples


View figure.

Schedule Interval and the SQLMSTR HOLIDAYS File

When the product automatically reschedules a job to execute, it references the SQLMSTR HOLIDAYS file, which resides on the service machine's 191 A-disk, to determine whether the proposed date matches one of the locally established holidays. See SQLMSTR HOLIDAYS File for a detailed explanation of holiday scheduling. 6 If a match is found, the product will use the specified alternate date for the job's next execution. The alternate day can be earlier or later than the holiday. In the example, March 5th is a holiday and March 6th is the alternate day. After job A completes on March 4th, it is rescheduled to run on the alternate day, coincidentally a day it normally would have run had there not been a holiday. Job B is also rescheduled to run on the alternate day after it executes on March 3rd. Jobs C and D are not impacted by the holiday.

Job Priority

The product can initiate several jobs to execute concurrently as long as no two jobs are vying for the same resource; for example, a Control Center support machine. If and when this should occur, it will favor one job over all others, initiating it to execute while the others are put on hold. As one jobs completes, the product will initiate the next as long as all other dependencies for that job are satisfied. You can control which jobs are favored over others by assigning a priority to each job. The job priority, which ranges from 1 to 9, where 1 is the highest, acts as the tie-breaker in these situations.

In the example below jobs A and B are to begin execution at the same time on support machine MSTRSUP. Since job A has the higher priority, it is initiated first and job B is initiated after it completes.

Figure 44. Job Priority Example


View figure.

Execution Window

The job execution time window defines a period of time within which a job is to begin and complete execution. The product will initiate a job as early as possible within the execution window, after all other dependencies have been met, as long as it determines that the job will complete prior to the end of the window. This allows you to restrict the execution of jobs to periods of low system usage. Conversely, it allows you to prevent the execution of jobs from overlapping into periods of high system usage.

If a job does not execute during the defined execution window, due to system downtime or dependencies not being met, the product will notify you and automatically reschedule the job for the next available window based on the job's defined schedule interval. Jobs scheduled to execute one time only will be placed in an inactive status.

|Regardless of the interval, a job will only run once in an execution |window. For example, if you define a three hour window, you cannot |schedule a job to execute every 30 minutes within that window.

Control Center uses a job's average runtime to determine whether it can complete within the time remaining in the defined execution window. The average runtime is calculated automatically based on the five most recent successful job executions. If it determines that there is insufficient time in the current window, the job will automatically be rescheduled.

In the example that follows, three jobs of varying average runtimes are scheduled to run concurrently. All are scheduled to start at 1:00 a.m. and have a defined window end time of 5:00 a.m.. Due to an unplanned event, the system is unavailable from 1:00 a.m. until 4:00 a.m.. When the system comes back online, only one hour remains before the end of the execution window. At that time, it initiates jobs A and B since both have an average runtime of less than an hour and should complete prior to 5:00 a.m.. Job C has an average runtime of one and a half hours and will not be able to complete by the end of the execution window. The product automatically reschedules it to execute during the next available execution window.

Valid start times for jobs A and B are indicated by the bars (&cursor.&cursor.&cursor.).

Figure 45. Job Execution Window Example


View figure.


Job Scheduling Tool

The Job Scheduling tool is available as an option within many of the System Administration and Database Administration tools. It is also a part of the Master Scheduling tool, where it can be used to schedule non-Control Center tools, such as your own internally developed tools. The Master Scheduling tool is discussed in Appendix D, "Master Scheduling Tool".

The Job Schedule List tool is used to list all jobs for a given database, view job output, modify and reschedule jobs, delete jobs, and initiate jobs for immediate execution. Refer to Job Schedule List Tool.

Job Scheduler Panel

The basic Job Scheduling entry panel is shown below. Except for the Server-mach entry field, it is the same regardless of which tool you're scheduling. The Server-mach entry field is not applicable when scheduling tools that execute on the target database machine (single user mode tools).

Figure 46. Job Scheduling Tool Entry Panel

+--------------------------------------------------------------------------------+
| mm/dd/yyyy                     CONTROL CENTER                      hh:mm:ss    |
|*------------------------------- Job Scheduler -----------------------------*   |
|| Command ===>                                             CTRLID: MSTRSRV  |   |
|| Jobname        ==> ________                               NODE:  VMSYSTM  |   |
|| Server-mach   ==> ____________________ (Required for Multi-user mode)     |   |
|| Job-status         ==> S    (S=Scheduled, A=Active, F=Failed, I=Inactive) |   |
|| Priority           ==> 5    ( 1 through 9, 1 = HIGH, 9 = LOW )            |   |
|| Next-start         ==> 19970419 23:00   ( format: YYYYMMDD HH:MM )        |   |
|| Window-end         ==> 19970420 08:00   ( format: YYYYMMDD HH:MM )        |   |
|| Schedule-interval  ==> 2WK        ( ONCE or form nnnXX, where XX is:      |   |
||                                      MI, HR, DY, WK, WD, WE, MO, YR )     |   |
|| Required-database  ==> SQLDBA           ( Database machine-id )           |   |
|| Required-dbstatus  ==> U                ( U=Up, D=Down, A=Any )           |   |
|| Dependent-jobname  ==> ________         ( Prior job must run first )      |   |
|| Dependjob-result   ==> _                ( S=Successful, F=Failed, A=Any ) |   |
|| Average-runtime    ==> 01:00            ( format: HH:MM )                 |   |
|| Last-jobstart      ==> ______________   Last-jobend  ==> ______________   |   |
|| Notify   ==> MSTRSRV1                                                     |   |
|| Execute  ==> SQLRBIND SQLDBA                                              |   |
||                                                                           |   |
||                                                                           |   |
|*---------------------------------------------------------------SQMSCHDM----*   |
| PF: 1 Help   2 Detailed Help   3 End (Cancel)     6 Schedule                   |
|                                                                                |
+--------------------------------------------------------------------------------+

 

Entry Field
Description

Jobname
Uniquely identifies each scheduled job. The jobname is limited to a maximum of eight alphanumeric characters. Special characters must be avoided unless they are valid for filenames and filetypes of CMS files.
Usage Consideration:
  1. Duplicate jobnames are not allowed within the product, regardless of which database they execute against or where they run.
  2. Jobnames can not contain an underscore.

Server-mach
Applicable only for multiple user mode tools. Identifies the Control Center support machine where the tool executes.

The job schedule is maintained on the Control Center service machine specified by your communication path setting shown in the upper right-hand corner of the panel. Refer to Control Center Communication Path and Database Settings. When the product initiates a multiple user mode job, it sends the appropriate command to the specified support machine where it is executed.
Note!

  • Database Administration tools must not be scheduled to execute on the service machine where they will adversely impact the product's ability to communicate with the database machines it manages. They should be scheduled to execute on a Control Center support machine or a user machine. Refer to Table 2 for a list of tools.
  • System Administration Tools should always be scheduled to execute on the Control Center service machine. Refer to Table 1 for a list of tools.
  • The Server-mach field should be left blank or contain the Control Center service machine name when the EXECUTE field is a command to be executed on the database console; (SQM SQLDBA SQLEND ARCHIVE).

Job-status
A single-character flag which indicates the status of the job at any given point in time. When the job is initially entered, the Job-status value should be set to "S" to indicate that it is Scheduled for execution. When it initiates the job, the Job-status will be changed to "A" to indicate that the job is Active. If the job completes successfully, the product will change the Job-status back to "S" and automatically reschedule the job for its next specified execution. If the job fails, the Job-status is changed to "F", which will essentially prevent the job from automatically executing again until someone manually intervenes to correct the cause of the failure and change the Job-status back to "S". Finally, Job-status value "I" is used to indicate that a job is inactive. It can be specified manually to temporarily remove a job from automatic execution.

Priority
An integer between 1 and 9 which indicates the relative priority of this job compared to other jobs within the product schedule. A value of 1 indicates the highest priority, while a value of 9 indicates the lowest priority. This parameter is only considered by the product during job initiation time. If two or more jobs are scheduled for initiation at the same time and all dependencies have been met for each job, the job priority will indicate which job will be initiated first. If multiple jobs depend on a common resource (such as a specified Control Center support machine), then the jobs will be executed in sequential order based on the specified priorities. See Job Priority for more information.

Next-start
Identifies a dependent date and time that must be reached before the job is initiated. It does not guarantee that the job will begin at the specified date/time, but only that the job will not be initiated prior to this date and time. Actual start date/time will vary based on when all job dependencies are met.

Together, the Next-start and Window-end parameters define the execution time window within which the job is to begin and complete execution. See Execution Window for more information.

The format of this parameter is YYYYMMDD hh:mm, where YYYY is a four-digit year, MM is a two-digit month, DD is a two-digit day, hh is a two-digit number to indicate the hour of the day (01 to 24), and mm is a two-digit number to indicate the minutes (01 to 59). An asterisk, "*", will appear next to the Next-start date when modifying the job and a "Rescheduled because of holiday" message will appear when viewing the job if this job has been scheduled to run on an alternative date as defined in the SQLMSTR HOLIDAYS file. See SQLMSTR HOLIDAYS File.
Usage Consideration:The data entry format must be followed exactly, including leading zeroes, spaces, and colons, to be accepted as valid input.

Window-end
The Window-end parameter is used with the Next-start parameter to define the execution time window within which the job is to begin and complete execution. For more information, see Execution Window.

The data entry format is the same as that for the Next-start parameter (YYYYMMDD hh:mm).

Schedule-interval
Specifies the frequency of job executions. Each time the job executes successfully, the product will use this value to automatically reschedule it to execute again. To schedule a job for a single execution, enter the keyword ONCE. All other intervals are specified by using an integer value between 1 and 999 with a two-character keyword to indicate the Unit of Measure. |The most useful intervals are 1WK (once a week) and 1DY (once a |day).

Valid two-character keywords are:

MI
for minutes
HR
for hours
DY
for days
WD
for weekdays
WE
for weekends
WK
for weeks
MO
for months and
YR
for years

Example Schedule-intervals are:

23MI
Every 23 minutes |
|1DY
|Once a day
2DY
Every 2 days |
|1WK
|Once a week
3WK
Every 3 weeks
1MO
Every month

Refer to |SQLMSTR HOLIDAYS File for more information.
Usage Consideration:The NEXT-START and WINDOW-END fields will be used in combination with the SCHEDULED-INTERVAL field to determine the NEW-START time. A job will only run once in a scheduled window, regardless of the interval.

Required-database
This parameter is optional, but should be used for all jobs that require a database to be available in a specified state (up or down) before it can be executed. The required state is indicated by the related Required-dbstatus parameter.

Required-dbstatus
This parameter is valid only when a database is entered for the Required-database parameter. It indicates what status the Required-database must be in before the product will initiate the job.

Possible values are:

U
The database must be Up in multiple user mode before the job can be initiated.
D
The database must be Down before the job can be initiated.
A
The database can be in ANY state (up or down) for the job to be initiated.
Operational Note:Specifying "A" (Any) will still prevent the job from being initiated if the database is in a status other than up or down (such as archiving).

Dependent-jobname
An optional parameter used to specify another Control Center job that must execute before this job. This parameter allows a group of jobs to be scheduled to execute in sequence, such as an archive job, followed by a reorganization job, followed by another archive. The Dependjob-result parameter is used to specify whether the previous job must complete successfully or not.

Dependjob-result
This parameter is only valid when the Dependent-jobname parameter is used to specify a dependent Control Center job that must execute first.

Possible values are:

S
The dependent job must complete Successfully before this job will be initiated.
F
The dependent job must Fail before this job will be initiated.
A
Any completion status of the dependent job is acceptable for this job to be initiated.

Average-runtime
Initially, this parameter should be set with your estimate of how long the job will run; it is entered in the form hh:mm, where hh is a two-digit integer indicating hours and mm is a two-digit integer indicating minutes. Afterwards, the product will automatically maintain this parameter by updating it each time the job completes successfully, using the average runtime from the previous five successful runs.

If you change the average runtime value on the panel and press PF6, the RUNTIMES file will be updated with five entries using the new average runtime. This will change the average runtime for the job to the new average runtime selected. The five entries in the RUNTIMES file will show UPDATED in the STATUS field.

When all job dependencies have been met, including the Next-start date/time, the product will add the average runtime value to the current time of day and compare the result with the value of the Window-end parameter. If it determines that the job cannot complete prior to the Window-end time, then the job will not be initiated. Instead, it will reschedule the job by adding the Schedule-interval value to the Next-start and Window-end parameters. If the Schedule-interval parameter is ONCE, indicating that it cannot be rescheduled, the job-status value is changed to inactive. The job can then be manually rescheduled or started immediately using the Job Schedule List tool.

Last-jobstart
Maintained automatically by the product. It is updated each time the job is initiated and, under most circumstances, should not be updated manually. It is used by the Job Scheduling tool to determine whether job dependencies have been met.

Last-jobend
Maintained automatically by the product. It is updated each time the job completes and, under most circumstances, should not be updated manually.

Notify
Specifies the users who should be notified when the job executes, if it fails, and if it does not execute within the defined execution window.

The syntax for entering the Notify parameter is given below.



   .-------------------------------.
   V          (1)                  |
>>---+-userid-------------------+--+---------------------------><
     |                     (2)  |
     +-userid--AT--nodeid-------+
     |          (3)             |
     '-nickname-----------------'
 


Notes:



  1. A local user. Nodeid is assumed to be the same as that of the
    Control Center service machine.

  2. A remote user. The nodeid is different than that of the Control
    Center service machine.

  3. A nickname within the CMS NAMES file on the Control Center service
    machine's 191 A-disk. Refer to the NAMES command documentation
    provided with VM/CMS. The nickname format allows multiple users to be
    associated with a single nickname, which eliminates the limited space
    restrictions of the parameter input panel.


Execute
The executable command that is processed when the job is initiated. Unless you're scheduling a job using the Master Scheduling tool, this command is built for you automatically based on your input to the various data entry panels associated with the tool being scheduled.

Understanding the command and command syntax requires familiarity with the product's command mode interface. Refer to Appendix G, Command Mode Interface.


Job Schedule List Tool

The Job Schedule List tool is a comprehensive tool for managing all Control Center jobs for a given database. This includes jobs that are scheduled, active, have failed, or are inactive.

Scheduled Job List Panel

Listed are all jobs for the database identified by your communication path and database settings shown near the top of the panel. The communication path can be changed using Option C from the Control Center Main Menu, whereas the database setting can be changed on the Control Center Main Menu panel itself. See Control Center Communication Path and Database Settings on page "Control Center Communication Path and Database Settings".

Figure 47. Job Schedule List Tool

+--------------------------------------------------------------------------------+
| mm/dd/yyyy                     CONTROL CENTER                      hh:mm:ss    |
|*----------------------------- Scheduled Job List --------------------------*   |
|| Command ===>                                             CTRLID: MSTRSRV  |   |
||    Database ===> SQLDBA                                   NODE:  VMSYSTM  |   |
|| Sel      Date      Jobname  Stat           Executable Statement           |   |
|| --- -------------- -------- ---- ---------------------------------------- |   |
||  _  19970205 15:30 ARCHIVE   S   SQM MSTRSUP SQLEND ARCHIVE               |   |
||  _  19970210 14:15 SQLREORG  S   SQLREORG SQLDBA PUBLIC.DSQTSCT3          |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||      Select:   V = View, M = Modify, D = Delete, S = Start Immediate      |   |
||                O = List Job Output,  R = Display Runtimes                 |   |
||                       Page 1     of 1                                     |   |
||                                                                           |   |
|*---------------------------------------------------------------SQMSCHDL----*   |
|PF:  1 Help   3 End   4 Sort/date   5 Sort/jobname                              |
|     10 Refresh Job List Data      12 Dependencies Display                      |
|                                                                                |
+--------------------------------------------------------------------------------+

Column Heading
Description

Date
The scheduled execution date and time. Actual start date/time will vary based on when all job dependencies are met.

Jobname
The jobname which is unique among all jobs managed by the Control Center service machine.

Stat
The current job status.

Possible values are:

S
Job is scheduled for execution.

A
Job is currently active.

See Problem Resolution.

F
The job failed during the last execution.

When a job fails, the product does not automatically reschedule it for the next schedule interval. Manual intervention is required to correct the problem and change the status back to 'S'.

I
The job is inactive. It will not be executed.

You can place a job in an inactive status to temporarily remove it from automatic execution by the product. Jobs scheduled to execute one time only are placed in an inactive status after they execute.

Executable Statement
The executable command that is processed when the job is initiated.

The following column is displayed when PF12 (Dependencies Display) is selected.

Current Dependencies
Shown are the current unsatisfied job dependencies. Keyword window indicates that the current date/time is not within the defined execution window.

Select Options

Select options can be invoked against listed jobs.

Select Option
Action

View (V)
Displays current schedule information for the selected job, including the status of each job dependency.

Modify (M)
Invokes the Job Scheduling tool to display the selected job and allow modification of all job parameters.

Delete (D)
Deletes job. You will be prompted to confirm the delete request.
Usage Consideration:Prior to deleting a job you should delete all job output using the List Job Output (O) select option.

Start Immediate (S)
Initiates immediate execution of job. Current job dependencies will be ignored, allowing the possibility that the job initiation or execution can fail.

List Job Output (O)
Lists job output files. Refer to Job Output Filelist Panel.

Display Runtimes (R)
Displays the start and end times, elapsed time (runtime), and completion status for the fourteen most recent job executions. The runtime history file is not created until the job is run for the first time.

PF Key Selections

 

PF Key
Action

Sort/date (PF4)
Sorts list by date.

Sort/jobname (PF5)
Sorts list by jobname.

Refresh Job List Data (PF10)
Refreshes all job list information.

Dependencies Display/Executable Statement Display (PF12)
Switches display between the 'Executable Statement' and the 'Current Dependencies' columns.

Job Output Filelist Panel

Job output is saved on the machine where the job executes and can be viewed, modified, and deleted from the Job Output Filelist panel.

Figure 48. Job Output Filelist Panel

+--------------------------------------------------------------------------------+
| mm/dd/yyyy                     CONTROL CENTER                      hh:mm:ss    |
|*----------------------------- Job Output Filelist -------------------------*   |
|| Command ===>                                             CTRLID: MSTRSRV1 |   |
|| Job Name:  DSQWKLY                                        NODE:  VMSYSTM  |   |
||     FILENAME FILETYPE FM      DATE     TIME                               |   |
||   _ DSQTSCT3 LISTING  A1    04/20/97  10:34:20                            |   |
||   _ DSQTSCT3 UNLIST   A1    04/20/97  10:34:13                            |   |
||   _ DSQTSCT3 EXEC     A1    04/20/97  10:34:12                            |   |
||   _ DSQTSCT3 SQLDBSU  A1    04/20/97  10:34:03                            |   |
||   _ DSQTSCT3 UNLOAD   A1    04/20/97  10:33:47                            |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||                                                                           |   |
||          Select:   V = View, M = Modify, D = Delete                       |   |
||                            Page 1      of 1                               |   |
||                                                                           |   |
|*---------------------------------------------------------------SQMOLIST----*   |
|PF:  3 End   4 Sort/date  5 Sort/name                                           |
|                                                                                |
+--------------------------------------------------------------------------------+

Column Heading
Description

FILENAME
Job output filename.

FILETYPE
Job output filetype.

FM
Job output filemode.

DATE
Date when output file was created.

TIME
Time when output file was created.

Select Options

Select options can be invoked against listed job output files.

Select Option
Action

View (V)
Displays the output file using XEDIT.

Modify (M)
Displays the output file using XEDIT; modifications can be made and the source updated. You will be prompted to confirm the update of the file on the target machine.

Delete (D)
Deletes the output file. You will be prompted to confirm the delete action.

PF Key Selections

 

PF Key
Action

Sort/date (PF4)
Sorts list by file creation date.

Sort/name (PF5)
Sorts list by filename.


Job Scheduling Architecture

The underlying scheduling interrupt capability of the product is implemented using the SQLMSTR TIMES file maintained on the Control Center service machine's 191 A-disk.

Each entry in the SQLMSTR TIMES file specifies a date (can be specified for repetitive interrupts), time, and a command that is to be executed at each interrupt. A direct interface to the SQLMSTR TIMES files |is provided using the Master Scheduling tool, but all other user interfaces are through the Job Scheduling tool.

The Database Monitoring tools do not utilize the job scheduler. These tools are designed to operate independently of all other scheduled activities, and therefore do not require the additional dependency characteristics provided by the Job Scheduling tool.

The job scheduler utilizes several additional files on the Control Center service machine which provide data that eventually flows into the SQLMSTR TIMES file as scheduled interrupts. Prior to the actual entry of a scheduled job into the SQLMSTR TIMES file, a thorough schedule analysis is performed by the job schedule analyzer routine. The analyzer reviews the condition of all databases, the current status of all scheduled jobs, and other job-related factors to determine whether the event should be scheduled to execute, and if so, the proper date and time for initiation.

There will always be an entry within the SQLMSTR TIMES file for every scheduled Control Center job, but the scheduled event will differ depending on the results of the job schedule analysis. If the job is ready for execution (all dependencies have been met), the event for the job will be INITIATION. If the job has any dependencies that remain unsatisfied, then the event for the job will be to RESCHEDULE the job at the end of the currently defined window. (If all job dependencies are met before the event interrupt causes the job to be RESCHEDULED, the event will be changed to START JOB). If the job is currently running, the SQLMSTR TIMES file will contain an interrupt entry for the job to issue a warning message if it runs past the end of the job's specified processing window.

Related Files

Several different files are maintained by the job scheduler on the 191 A-disk of the Control Center service machine to manage scheduled jobs. The scheduling parameters of each job are maintained in a CMS file with a filename equal to the jobname and a filetype of SQMJOB. When a user executes the VIEW, MODIFY, or DELETE functions for a specific job, the SQMJOB file is accessed through the Control Center interface.

The information from each separate SQMJOB file is collected by the job scheduler into a single master schedule file with a filename filetype of SQLMSTR JOBS. This file contains additional information about job dependencies generated by the job schedule analyzer.

The information within the SQLMSTR JOBS file is translated by the job scheduler into specific time/date interrupts that are then inserted into the SQLMSTR TIMES file. This file contains the actual interrupt driver events that will trigger the initiation of a job at the appropriate date and time.

When each job executes, the job scheduler will record the start and stop times, and the results (success or failure). This information is kept in a separate file for each job. The filename of each file will be the applicable jobname and the filetype will be RUNTIMES.

The job scheduler will also utilize the SQLMSTR HOLIDAYS file during job rescheduling to avoid the possibility that jobs will be scheduled for execution on days when the system will be unattended, such as holidays or weekends. The SQLMSTR HOLIDAYS file is maintained on the Control Center service machine's 191 A-disk by the Administrator. It contains future dates which should be avoided by scheduled jobs, along with alternate dates which should be used if any job would normally be scheduled on the given date.

SQMJOB File

The scheduling parameters of each job are kept on the service machine's 191 A-disk in separate CMS files named jobname SQMJOB. An SQMJOB file is created when a job is initially scheduled. It contains parameter tags in the format of CMS NAMES file tags, along with the associated parameter values. To avoid the possibility of incorrectly modifying the tag syntax, these files should not be updated manually.

Figure 49 is an example of an SQMJOB file for a job with jobname QMFREORG that is scheduled to reorganize a QMF DBSPACE every two months. It uses Control Center support machine MSTRSUP and requires the SQLMACH database virtual machine to be UP in multiple user mode. The SQLREORG command executes against dbname SQLDBA.

Figure 49. Example SQMJOB File

:Nick.QMFREORG
:Jobname.QMFREORG
:Server_machine.MSTRSUP
:Job_status.S
:Priority.5
:Next_start.19970130 23:00
:Window_end.19970201 08:00
:Schedule_interval.2MO
:Required_database.SQLDBA
:Required_dbstatus.U
:Dependent_jobname.
:Dependent_jobresult.
:Average_runtime.00:53
:Last_jobstart.19961130 23:20
:Last_jobend.19961201 00:17
:Notify.MSTRUSR
:Execute.SQLREORG SQLDBA PUBLIC.DSQTSCT3
:Holiday_flag.

SQLMSTR JOBS File

The SQLMSTR JOBS file will contain information about all the product's jobs, including all current dependency status data. Each record contains all scheduling information for a single job. The SQLMSTR JOBS file is created and maintained on the service machine's 191 A-disk and should never be modified manually. Figure 50 provides the layout of parameters within each record of the file.

Figure 50. SQLMSTR JOBS File Layout

POSITION(S)    PARAMETER DESCRIPTION
-----------    ------------------------------------------------------
  1 -   8      Jobname
 10 -  29      Server-machine
 30            Server-machine availability flag
 31            Holiday file processing flag
 32            Job-status
 34            Priority
 36 -  49      Next-start
 50            Start time exceeded flag
 52 -  65      Window-end
 67 -  71      Schedule-interval
 73 -  80      Required-database
 82            Required-dbstatus
 83            Required-database availability flag
 85 -  92      Dependent-jobname
 94            Dependjob-result
 96            Dependent job completed flag
 97 - 101      Average-runtime
103 - 116      Last-jobstart
118 - 131      Last-jobend
133 - 192      Notify
194 - *        Execute

SQLMSTR TIMES File

The SQLMSTR TIMES file will contain an entry for each scheduled product job. The scheduled executable statement within the TIMES file will be EXEC SQMJOB, not the executable statement contained within the Execute parameter of the job itself. The EXEC SQMJOB statement of the TIMES file will include an action keyword and the name of the scheduled job, as shown in Figure 51.

STARTJOB

The STARTJOB action keyword indicates that all job dependencies have been met and the job will be INITIATED by the product on the specified date and time. The QMFREORG job in the example SQLMSTR TIMES file has all dependencies satisfied and will be initiated at 11:00 p.m. on January 30th, 1997.

RESCHEDULE

The RESCHEDULE action keyword indicates that a job has at least one dependency that has not been met. If all dependencies are not met before the specified date and time, the product will automatically reschedule the job for the next available execution window using the Schedule-interval of the job. The SUMINDEX job in the example SQLMSTR TIMES file is waiting for at least one dependency to be met and will be rescheduled to execute at a later date and time if the dependency has not been met by 6:00am on February 25th, 1997. If all dependencies are met before that date and time, the product will change the SQLMSTR TIMES entry from SQMJOB RESCHEDULE to SQMJOB STARTJOB, with a new date and time for the job to be initiated.

WINDOWEND

The WINDOWEND action keyword indicates that a job is currently ACTIVE, and a notification message will be sent to the appropriate product users if the job is still active beyond the date and time specified for the Window-end parameter of the job. The MAINTJOB job in the example SQLMSTR TIMES file is scheduled to notify users at 8:00 a.m. on January 19th, 1997 that the job has run beyond its defined Window-end date and time. If the job completes before the specified value, the product will automatically change the WINDOWEND entry and reschedule the job for its next execution.

Figure 51. Example SQLMSTR TIMES File

01/30/97 23:00:00 ........ EXEC SQMJOB STARTJOB QMFREORG
02/25/97 06:00:00 ........ EXEC SQMJOB RESCHEDULE SUMINDEX
01/19/97 08:00:00 ........ EXEC SQMJOB WINDOWEND MAINTJOB

RUNTIMES File

The job scheduler keeps track of each job execution within a separate RUNTIMES file for each job. RUNTIMES files are maintained on the service machine's 191 A-disk with a filename equivalent to the jobname and a filetype of RUNTIMES.

Each time a job executes, the job scheduler will add another entry to the job's RUNTIMES file which records the start time, completion time, elapsed time (hours and minutes), and whether the job failed. |The job was successful unless it is marked as |"FAILED." This file is used by the job scheduler to calculate the Average-runtime value, using the last five successful entries within the file to update the average runtime of the job. The job scheduler automatically purges old entries from the RUNTIMES file, only maintaining the most recent 50 job executions.

|Changing the Average Runtime of a job on the job menu |automatically resets the Average Runtime for that job. This Average |Runtime is reset by adding five entries (with the new average runtime) to the |RUNTIMES file.

Shown below is an example of a RUNTIMES file.

Figure 52. Example RUNTIMES File

20000111 02:21 20000111 02:59 00:38 FAILED
20000111 23:30 20000112 00:42 01:12
20000118 02:10 20000118 03:27 01:17

SQLMSTR HOLIDAYS File

The SQLMSTR HOLIDAYS file allows each installation to provide the job scheduler with information about specific days that should not be considered for job execution. For example, if the local installation is closed for an entire week in July, on Easter, and on Christmas Day, the job scheduler can be instructed to avoid scheduling jobs on any of these days. For each day that the job scheduler should avoid, an alternate |date can be provided or the word SKIP can be specified to indicate |that the job should not run at all. When the SKIP option is used, the |job is automatically rescheduled for the next scheduled execution |interval.

When the job scheduler determines the correct date for the next execution of each job, the SQLMSTR HOLIDAYS file is referenced to determine whether the proposed date matches one of the locally established holidays. If a match is found, the specified alternate date is used. |The SQLMSTR HOLIDAYS file is checked each time a job is |rescheduled. However, if the SQLMSTR HOLIDAYS file is updated, then |all scheduled jobs are checked to see if their next start date matches a |holiday date in the file.

|The Holiday_flag parameter in the SQMJOB file is used to indicate if |a job has been rescheduled because of a holiday in the SQLMSTR HOLIDAYS |file. If the Holiday_flag is set to Y, then the job will be scheduled to run on an alternative date. Both the holiday date and the alternative date are defined in the SQLMSTR HOLIDAYS file that is maintained on the CTRLCTR service machine's |"A" disk.

After the job executes it will be rescheduled based on the original next-start date. A sample HOLIDAYS file (SQLMSTR $HOLIDAY) is provided on the code disk.

SQLMSTR HOLIDAYS file features include:

  1. Automatic rescheduling when a new SQLMSTR HOLIDAYS file is received by the CTRLCTR service machine. If a new SQLMSTR HOLIDAYS file is sent to the CTRLCTR service machine, the scheduler will check all the currently scheduled (status "S") jobs against the new SQLMSTR HOLIDAYS file. If the job has not already been re-scheduled because of a holiday, the job will be re-scheduled to the alternative date.
  2. If you indicate "SKIP" as the alternative date in the SQLMSTR HOLIDAYS file, the job will automatically be re-scheduled to run on the next normally scheduled date after the holiday.
  3. When modifying a JOB through the job menu, an asterisk, "*", will appear next to the Next-start date to indicate that the job is scheduled to run on an alternative date.

    When viewing a JOB through the job menu, a "Rescheduled because of holiday" message will appear next to the Next-start date date to indicate that the job is scheduled to run on an alternative date.

If you modify an existing JOB through the menu by changing the the next-start date the holiday-flag will be set to blank. The Holiday_flag job parameter will not appear on the job menu and should not be changed by the user.

Figure 53 provides an example of the SQLMSTR HOLIDAYS file. The first date on each line represents the holiday to be avoided and the second date represents the alternate date for jobs to be scheduled. Note that the dates must be given in the form YYYYMMDD, where YYYY is a four-digit year, MM is a two-digit month, and DD is a two-digit day. Any characters beyond the second date on each line are considered as comments and will be ignored by the product. Also note that times should not be indicated, only dates. |The alternative date can be earlier than the holiday date, but it |cannot be earlier than the current date. You cannot use the same |alternative date more than once, but SKIP can be used for any or all |holidays.

Figure 53. Example SQLMSTR HOLIDAYS File

19990101 SKIP     * New Year's Day
20000328 20000406 * Good Friday
20000330 20000407 * Easter
20000526 20000527 * Memorial Day
20000704 20000705 * Independence Day
20000901 20000909 * Labor Day
20001127 20001125 * Thanksgiving
20001128 20001126 * Thanksgiving day 2
20001225 SKIP     * Christmas
20010101 SKIP     * New Year's Day - skip all jobs

There are two ways that the SQLMSTR HOLIDAYS file can be created and updated. One method is to stop the service machine, log onto it, create/modify the file (using XEDIT), then restart the service machine. Another method is to use the FILELIST (F) option under the General Control Center commands (G) option on the main menu. This option allows the file to be modified from your user ID using XEDIT and then migrate it to the service machine.


Problem Resolution

Correcting Active Job Status

If an executing job is interrupted by some means and is unable to end through the normal job completion process, the job status will not be updated. In effect, the job is stuck in an active status. After determining that the job is no longer active, you can use the modify option of the Job Schedule List tool to change the job status.

Resetting Average Runtime

The average runtime is automatically calculated by the product based on the last five successful runs. An unusually long job runtime, possibly due to processing problems, can inflate the average runtime to the point where it impacts job scheduling. |To correct the Average Runtime, change its value on the job update |menu and reschedule the job. You do not have to change the parameters |of any other jobs.


Footnotes:

6
Generating and updating the SQLMSTR HOLIDAYS file is the responsibility of the Control Center System Administrator.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]