Scheduling Jobs by Date


  1. Scheduling Jobs by Date
    1. Scheduling
      1. Rules
      2. Planning Ahead
      3. How the Schedule Facility Starts the Required Jobs
      4. Catering for Special Requirements not Handled by Schedule
      5. Telling Jol Which Days are HOLIDAYS
      6. Other Useful Facilities for Use in Scheduling

Scheduling

Jol's Scheduling System is extremely simple to use and written entirely in high level Jol Code; this allows you to easily make changes to the system to suit your installation. Using the Scheduling Facility, it is possible to program job schedules for days, months, or even years in advance. All your existing jobs can be started without changes. Furthermore, Jol can be used to schedule your de-bugged and already tested jobs written in JCL. Full Jol symbolic variable processing is allowed, even with JCL jobs.

The Jol Schedule Data Set contains various members that can be used to specify which jobs are to run on WORKDAYS, HOLIDAYS, MONDAYS, TUESDAYS, etc., and jobs for particular dates such as JUL12. At a time suitable to you, Jol examines this data set and prepares all the appropriate jobs for execution.

Note: So that you can submit jobs on the day(s) before or after a Holiday, there is prototype code provided in member SPECIAL of the Schedule Data Set.

In general, to specify which jobs are to be started, code the name of the member containing the job in the JOL.SCHEDULE data set using the PREPARE command. For example, to indicate which jobs are to be executed daily is done by coding the names of the jobs in member WORKDAY, as shown below.


        PREPARE BACKUPS;

        PREPARE ACCOUNTS;

        PREPARE PAYROLL;


Figure 4-1: Indicating Which Jobs are to Run.

The jobs named are submitted for execution on the appropriate days. Jobs may contain any Jol instruction, and include networking instructions. For example, even daily jobs can examine the Jol calender or accept information from the terminal and dynamically alter themselves before submission.

Rules

  • You may code more than one job name per line.

  • The jobs named are compiled by Jol, and then submitted for execution. Jobs may contain any Jol instruction, including Jol Job Networking instructions. For example, some jobs, even if submitted daily, may examine the Jol calender or accept information from the terminal using the Jol PANEL instruction and dynamically alter themselves before submission.

  • Even if a job is mentioned twice or more frequently, it will be submitted once only. For example, if a job is to be submitted on the first working day of January, but is also to be submitted on MONDAY, and the two coincide, only one job will be submitted.

Planning Ahead

Jobs in member WORKDAY are submitted on a daily basis. In addition, other members of the library are examined based on dates. The following members of the schedule data set are executed on the appropriate days:

WORKDAY Executed only on normal working days.
SPECIAL

Executed every day, see later pages for details

HOLIDAY Executed only on non-working days.
WEEKEND Executed only on Weekends.
SUN Executed on SUNDAYs.
MON Executed on MONDAYs.
TUE Executed on TUESDAYs.
WED Executed on WEDNESDAYs.
THU Executed on THURSDAYs.
FRI Executed on FRIDAYs.
SAT Executed on SATURDAYs.

 


Figure 4-2: Daily Members Examined by the Schedule Facility.

In addition, the following members of the schedule data set are executed (if present) on the specified days:


JAN01 Executed on January 1st.
JAN02 Executed on January 2nd.
...
FEB01 Executed on February 1st.
MAR01 Executed on March 1st.
APR01 Executed on April 1st.
MAY01 Executed on May 1st.
JUN01 Executed on June 1st.
JUL01 Executed on July 1st.
AUG01 Executed on August 1st.
SEP01 Executed on September 1st.
OCT01 Executed on October 1st.
NOV01 Executed on November 1st.
DEC01 Executed on December 1st.

Other jobs can be submitted on the last working day, the last day, the last working day -1 and so on. A member called SPECIAL has prototype code for these types of jobs.



Figure 4-3:
Month and Day Members Containing Scheduling Information.




MONWK01 Executed on the first Monday of the year.
MONWK02 Executed on the second Monday of the year.
MONWKnn Executed on the nth Monday of the year.
...
TUEWK01 Executed on the first Tuesday of the year.
TUEWKnn Executed on the nth Tuesday of the year.
...
WEDWK01 Executed on the first Wedsnesday of the year.
THUWK01 Executed on the first Thursday of the year.
FRIWK01 Executed on the first Friday of the year.
SATWK01 Executed on the first Saturday of the year.
SUNWK01 Executed on the first Sunday of the year.

Using MONWK01 etc allows you to submit jobs every second week, should you so desire.


Figure 4-4: Week Number and Day Members to be Examined

How the Schedule Facility Starts the Required Jobs

Once a day, Jol examines the Schedule data set. If it is not a holiday, it examines the WORKDAY member; if it is Saturday or Sunday, the data in these members is used instead, otherwise member HOLIDAY is used. Additionally, any other member such as JUL14 is also examined, if appropriate.

  • The names of the jobs found are converted to Jol INCLUDE statements and copied to a working file, each separated by an * JOL; separator card.

  • Jol then reads the file, and executes any instructions found therein as usual.

  • The jobs are then submitted.

    Below is a sample of the WORDAY member of the Schedule Data Set.


 /* This is the normal WORKDAY member of the JOL.SCHEDULE
Data Set.
It is examined on WORKING DAYS ONLY.
You may put in other Jol commands before you use the
PREPARE verb to prepare your work for submission.
See the example below for 'SPEC'.
*/

Prepare DAILYBU; /* Prepare Daily Backup Job */
PREPARE INVOICES; /* Prepare Daily INVOICE Job */

if %day='TUESDAY' /* If today is TUESDAY */

then prepare SPEC; /* then prepare a SPEC job */


Figure 4-5: Sample WEEKDAY Jobs

Catering for Special Requirements not Handled by Schedule

The ability to automatically submit jobs on every WORKDAY, MONDAY or even on ODD or EVEN weeks etc is highly flexible. However, sometimes you also need to be able to submit work on the day before a HOLIDAY, the day after a WORKDAY and so on. One way to do this is to place your PREPARE commands in the appropriate position in the SPECIAL member of the Jol Schedule file.

Before the SPECIAL file is examined, an array is set up so that you can easily determine if today, tomorrow, or today plus three days is a Holiday, or a Work Day. In addition to all the usual Jol Calendar Variables such as %DAY, %DAYNO, %MONTH etc, another variable called %LASTDAY contains the number of days in the current month. %LASTDAY is correct for Leap Years.

Using Jol programming language and the variables above makes special coding requirements easy to cater for.

The following page shows some of the coding that you may do in the SPECIAL file.













WORKDAY Group

Tomorrow is a Holiday





The day after tomorrow is a Holiday



The day after that is a Holiday




Yesterday was a
Holiday








Another Method for Testing if Yesterday was a Holiday











Tomorrow is the last WORKDAY in the week




The day after tomorrow is the last WORKDAY




The day after that
is the last WORKDAY

 /* This is the SPECIAL member of the JOL.SCHEDULE Data Set.            00010000
                                                                        00020000
    It is examined every day, and can test if TOMORROW is a             00030000
    Holiday, or yesterday and so on.  See the examples below. */        00040000
                                                                        00050000
    if %holiday='YES'                                                   00060000
    then do;                                                            00070000
         write 'We could PREPARE a job here';                           00080000
    end;                                                                00090000
                                                                        00100000
/* See if the next few days are HOLIDAYS */                             00110000
                                                                        00120000
    if %holiday='NO'                                                    00130000
    then do;                                                            00140000
         if %list(%dayno+1)='HOL'                                       00150000
         then do;                      /* TOMORROW is a Holiday */      00160000
             write 'We could PREPARE a job here';                       00170000
             PREPARE tomorrow;                                          00180000
             PREPARE B ;                                                00190000
         end;                                                           00200000
         if %list(%dayno+2)='HOL'                                       00210000
         then do;                      /* The NEXT day is a Holiday */  00220000
             write 'We could PREPARE a job here';                       00230000
         end;                                                           00240000
         if %list(%dayno+3)='HOL'                                       00250000
         then do;                      /* and +3 day is a Holiday */    00260000
             write 'We could PREPARE a job here';                       00270000
         end;                                                           00280000
         if %list(%dayno-1)='HOL'                                       00290000
         then do;                      /* YESTERDAY was a Holiday */    00300000
             write 'We could PREPARE a job here';                       00310000
         end;                                                           00320000
    end;                                                                00330000
                                                                        00340000
/* Sample ONLY:- See if Yesterday was a Holiday, and Today is a         00350000
   Workday.                                                       */    00360000
                                                                        00370000
    if %list(%dayno-1)='HOL'           /* Was YESTERDAY a Holiday */    00380000
    &  %list(%dayno)='WORK'            /* and TODAY a WORKDAY ?   */    00390000
    then do;                                                            00400000
        write 'We could PREPARE a job here for Yesterday''s Holiday';   00410000
        PREPARE yesthol;                                                00420000
        PREPARE B ;                                                     00430000
    end;                                                                00440000
                                                                        00450000
/* See if the next few days are the END OF MONTH */                     00460000
                                                                        00470000
    if %holiday='NO'                                                    00480000
    then do;                                                            00490000
         %work=%dayno+1;               /* Set WORK to TOMORROW  */      00500000
         if %work=%lastday then do;    /* TOMORROW is the LAST  */      00510000
                                          DAY of the month      */      00520000
             write 'We could PREPARE a job here';                       00530000
             PREPARE B ;                                                00540000
         end;                                                           00550000
         %work=%work+1;                /* Check the NEXT Day    */      00560000
         if %work=%lastday then do;    /* The NEXT day is the   */      00570000
                                          LAST DAY of the month */      00580000
             write 'We could PREPARE a job here';                       00590000
             PREPARE B ;                                                00600000
         end;                                                           00610000
         %work=%work+1;                /* Check the Day AFTER that */   00620000
         if %work=%lastday then do;    /* The NEXT day(+3) is the */    00630000
                                          LAST DAY of the month */      00640000
             write 'We could PREPARE a job here';                       00650000
             PREPARE B ;                                                00660000
         end;                                                           00670000
    end;                                                                00680000


Figure 4-6: Sample SPECIAL File.

Telling Jol Which Days are HOLIDAYS

The Scheduling System uses Jol's automatic Calendar facility to determine if the day of the week is a Saturday or Sunday, and automatically submits any jobs for the appropriate day.

However, Jol does not know which days are holidays in your country for any given year, or which other days in your organization are holidays for special reasons such as a nine day fortnight instead of the more usual ten day fortnight.

So that the Jol Scheduling System can determine which days are Holidays, Rostered Days Off and so on, you code these special days in a member called HOLS1988, HOLS1989 etc. The format is as the example for HOLS1987 shown below:



JAN 1         /* AUSTRALIAN HOLIDAYS       */       00010000
JAN 1         /* NEW YEAR'S DAY            */       00020000
JAN 26        /* AUSTRALIA DAY             */       00030000
APR 17        /* GOOD FRIDAY               */       00040000
APR 18        /* EASTER SATURDAY           */       00050000
APR 19        /* EASTER SUNDAY             */       00060000
APR 20        /* EASTER MONDAY             */       00070000
APR 25        /* ANZAC DAY                 */       00080000
JUN 8         /* QUEENS BIRTHDAY           */       00090000
DEC 25        /* CHRISTMAS DAY             */       00100000
DEC 26        /* BOXING DAY                */       00110000




Figure 4-7: Example of the HOLIDAY member in the Schedule Data Set.

As you can see in the example above, you code the the first three characters of the month, followed by at least one space and any optional comments. Note that each day must be on a separate line.

Because Jol uses the year as part of the member name, you can set up holidays for years in advance.

Other Useful Facilities for Use in Scheduling

Additionally, Jol allows:

  • Read and Write access to existing or new data sets at compile time.

    You may have data sets that contain other scheduling information or further details of work to be run on particular days, or under particular circumstances, or both. Using this data, Jol can create tailored job streams. These job streams can be created on finding the appropriate data in the schedule.

  • Access to the system calendar. Jol allows the date (year, month, day) and time to be accessed. Using this data, Jol can create tailored job streams.

  • Testing for the existence of data sets. Jol can test if a data set exists. If a data set does exist, it is possible to submit other jobs to run, or take a different path through the current job.

  • Symbolic Parameters or Variables can be passed from Job to Job.