; Note: comment lines in .INI files always start with a semicolon [Template] Description=Use this template to create a job that will start certain process at certain time on the [n] business day of every month. [Variables] ; Key values that have their name enclosed in % signs will be used for ; template wizard questionnaire and substitution variables ; such key values should consist of 2 comma separated parts: ; 1. Field Edit Style (EDIT, YES/NO, FILE BROWSE, ; DIR BROWSE, PROCESS BROWSE, ; FTP BROWSE, MAIL PROFILE LIST, ; REMOTE FILE BROWSE, REMOTE DIR BROWSE, ; REMOTE AGENT LIST, DB PROFILE LIST) ; 2. Prompt ; ; Example: %VAR%=EDIT,What is the name of the service that you want to monitor? ; ; Key values that don't have their name enclosed in % signs will be used for ; job properties (See online help on "Job property names for use with JDL command" ; topic for more details). ; ; Example: DAY_NUMBER=1 %PROGRAM%=FILE BROWSE,What program do you want to schedule? %DAY%=EDIT,Enter businesss day number when you want to run the program: %START_TIME%=EDIT,Enter job start time (hh:mm in 24-hour time format): %EMAIL_RECIPIENT%=EDIT,To whom do you want to sent the email alert in case if the job fails: %EMAIL_PROFILE%=MAIL PROFILE LIST,If you use MAPI email interface, then which email profile do you want to use? If you use Lotus Notes or SMTP email interfaces, enter User ID required for logging to your email system. %EMAIL_PASSWORD%=EDIT,If you are required to login to your email system, what is your password: JOB_TYPE=S COMMAND=%PROGRAM% SCHEDULE_TYPE=D START_TIME=%START_TIME% SLIDE_HOLIDAY=N SKIP=Y LOG=N ASYNC=N MSG_ERROR=Y MSG_EMAIL=Y MSG_ACCOUNT=%EMAIL_PROFILE% MSG_PASSWORD=%EMAIL_PASSWORD% MSG_RECIPIENT=%EMAIL_RECIPIENT% DESCRIPTION=Every month on the [n] business day this job kicks off the process. ; Notes: The script bellow can include substitution variables. ; Substitution variables must be specified in %VAR% format ; where VAR is the variable name. ; ; Everything after the next line will be used for the template script. ;======================================================================================== [Body] // this script calculates %DAY% business day of month and starts // %PROGRAM% process if today falls on the calculated business day // get first business day of the month Dim temp_date, Date, "@MS"mm/dd/yyyy"" // get today's date Dim today_date, date, "@t"mm/dd/yyyy"" Dim non_bus_day, boolean Dim countdown, number, %DAY% // before we start, decrease counter by 1 Minus countdown, 1, countdown LoopWhile countdown, END_LOOP isWeekEnd temp_date, non_bus_day ifThen non_bus_day, ADD_DAY isHoliday temp_date, non_bus_day ifThen non_bus_day, ADD_DAY // ok, temp_day is a busness day, decrease the counter Minus countdown, 1, countdown ADD_DAY: DateAdd temp_date, 1, temp_date END_LOOP: // ok, we found the %DAY% business day of month // now, compare today's date and the just calculated date // and if they are the same launch the program Dim date_match, boolean isEqual today_date, temp_date, date_match If date_match, RUN_TODAY, SKIP RUN_TODAY: Dim process_id, number LogAddMessageEx "INFO", "@V"job_id"", "@V"job_name"", "Today is %DAY% business day in this month. Starting %PROGRAM%..." Run "%PROGRAM%", "", process_id Exit SKIP: // uncomment the following line if you want to monitor this script daily runs // LogAddMessageEx "INFO", "@V"job_id"", "@V"job_name"", "Today is not the %DAY% business day in this month. Skipping..."