SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Complicated Date Scheduling

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Complicated Date Scheduling
Author Message
Gary Jensen



Joined: 22 Mar 2000
Posts: 28

Post Complicated Date Scheduling Reply with quote

I need to schedule a process to run on first business day after the 1st, 8th, 16th, and 24th. Is there a way to do this in Scheduler when setting up a job, or will I have to do some sort of fancy coding within the script?

Wed May 24, 2000 2:01 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Re: Complicated Date Scheduling Reply with quote

Script is the only option. By the way "fancy" coding is very strait forward in this case. Here is the real power of implementing virtually any schedules.

Create new user-defined statement (Script Library) that returns next busness day for any given date. Then create new job of script ype that checks
for 2nd, 9th, 17th, and 25th day and runs your program

=================================================
Here is the template for the job:

Dim time_to_run, boolean

// isNextBusDay - name of the user-defined statement
isNextBusDay 1, time_to_run
ifThen time_to_run, RUN_PROGRAM

isNextBusDay 8, time_to_run
ifThen time_to_run, RUN_PROGRAM

isNextBusDay 16, time_to_run
ifThen time_to_run, RUN_PROGRAM

isNextBusDay 24, time_to_run
ifThen time_to_run, RUN_PROGRAM

RUN_PROGRAM:

Dim process_id, number

Run "myprogram.exe", "", process_id

=================================================
Here is the template for the user-defined statement isNextBusDay:
Declare new statement with 1 parameter (start_day as number) and return type as boolean

Dim today, date
Dim bus_day, date
Dim bad_day, boolean
Dim day_number, number

// Get today's date
Today today
// if today is before or same as the specified start date then return False
Day today, day_number
isLessOrEqual day_number, start_day, bad_day
ifThen bad_day, NOT_GOOD

// calc. date for the specified start day as today minus today's day number
// to adjust to the month start and then plus start day to adjust to the
// specified day
Multiply day_number, -1, day_number
DateAdd today, day_number, bus_day
DateAdd bus_day, start_day, bus_day

// find first business day, go day by day till find good one
TRY_NEXT:

DateAdd bus_day, 1, bus_day

// weekned ?

isWeekend bus_day, bad_day

ifThen bad_day, TRY_NEXT

// holiday ?

isHoliday bus_day, bad_day

ifThen bad_day, TRY_NEXT

// if today is not the same as next bus. then skip today
NotIsEqual today, bus_day, bad_day
ifThen bad_day, NOT_GOOD

// ok, it's time to do the job
Return True

NOT_GOOD:
// bad day
Return False

=================================================
Enjoy!

PS. I didn't try this, you may need to do some fixing

: I need to schedule a process to run on first business day after the 1st, 8th,
: 16th, and 24th. Is there a way to do this in Scheduler when setting up a
: job, or will I have to do some sort of fancy coding within the script?

Wed May 24, 2000 3:14 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.