//============================================================================= // // Task: BIWEEKLY.TSK // (Bi-weekly execution on alternate specific days, i.e.,every 14 days) // Author: Avanti Technology, Inc. // http://www.avanti-tech.com // Version: 1.0 - First release [30 September 2003] // // Description: // ============ // On scheduled execution, determines whether this specific day is the first // or second occurrence within the bi-weekly period for the year to date and // terminates if does not match the specified occurrence. // // System Environment Variables (%0 - %9) used/usage: // -------------------------------------------------- // %1 Days since last completed two week period (set by CALC) // // The internal System Environment Variables are used to simplify processing // and maintenance on the script. For example, using %0 in place of the base // pattern allows us to easily change the base pattern throughout the task // merely by changing the DEFINE which sets its value. // // Objective: // ========== // Limit execution of the task to a bi-weekly basis (i.e., only one Sunday // every two weeks versus every Sunday, as scheduled for ease of scheduling). // // Usage: // ====== // Script should be scheduled for execution on a specific weekday. // // Script can be scheduled for automatic execution using Client interface or // using the TaskMaster TMSCHEDULE command at the TMConsole (Shell) Screen: // // Example: TMSCHEDULE ADD TRSTBKUP.TSK YNNNNNN 02:00 // (Scheduled for every Sunday [SMTWTFS] at 2:00am) // // Note: Scheduled tasks must reside either in SYS:SYSTEM or the // TaskMaster NLM load directory for security reasons. // // Compatibility: // ============== // This task has been tested on the following platforms without demonstrating // any compatibility issues or any other reported/confirmed conflicts: // TaskMaster v3.15c (or later), TaskMaster Lite v3.15c (or later) // NetWare v3.12 / v3.2 / v4.1x / v5.x / v6.0 // // Warning: // ======== // AS WITH ANY NEW SOFTWARE PROGRAM, BATCH SCRIPT, OR AUTOMATED PROCESSING // PROCEDURE, CAUTION SHOULD BE EXERCISED AND DUE DILIGENCE OBSERVED DURING // INITIAL IMPLEMENTATION. WHERE POSSIBLE, TESTING SHOULD BE PERFORMED ON // NON-PRODUCTION SYSTEMS PRIOR TO FULL IMPLEMENTATION. // // Comments: // ========= // This task script is provided free of charge and without any warranty or // guarantee of fitness of purpose or performance. // // For additional TaskMaster script examples, visit the Sample Tasks page // on the Avanti Technology, Inc. WEB Site: http://www.avanti-tech.com // //============================================================================= // Pre-format %1 to 2 digits (00-99) for subsequent IF string test (07) DEFINE %1 00 // Calculate the number of days since the last two week period completed CALC %1 %NDAY_OF_YEAR% - ((%NDAY_OF_YEAR% / 14) * 14) // To process the 1st occurrence of the scheduled day every 2 week period, use: // IF NOT "%1"<"07" // // To process the 2nd occurrence of the scheduled day every 2 week period, use: // IF NOT "%1">"06" // // This logic presumes processing the 1st occurrence in every 2 weeks is desired IF NOT "%1"<"07" ECHO. ECHO %TASK_NAME% ECHO Terminating - Not proper scheduled run date! ECHO. ABORT ENDIF // Remainder of task which SHOULD execute every other // (1st or 2nd, not both) scheduled date