[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]
Creating "retry on fail" jobs (self-rescheduling jobs)
// Normally this job runs daily at 11:30. It executes several database stored procedures after
// all required files arrived and successfully loaded into database. However, if some files "failed"
// to arrive on time, this jobs reschedules itself to repeat file check again in 30 minutes. When
// all required files exist, it restores original schedule and calls another job that actually
// loads files and executes stored procedures.
Dim found, boolean
// ... check for files
CHECK_ACCOUNTS:
FileExists( "k:\network\data\account.dat", found )
if( found, CHECK_HOLDINGS, RETRY_LATER )
CHECK_HOLDINGS:
FileExists( "k:\network\data\holding.dat", found )
if( found, CHECK_TRADES, RETRY_LATER )
CHECK_TRADES:
FileExists( "k:\network\data\trade.dat", found )
if( found, START_DB_LOAD, RETRY_LATER )
START_DB_LOAD:
JobRun( "Daily Database Load" )
TOMORROW_SCHEDULE:
Dim today, date
Dim tomorrow, date
Dim start_time, datetime
Today( today )
DateAdd( today, 1, tomorrow )
DateTime( tomorrow, 11:30, start_time )
JobModify( "File Watcher", "START_TIME", start_time )
// all done
exit
RETRY_LATER:
Dim today, date
Dim system_time, time
Dim start_time, datetime
Today( today )
Now( system_time)
DateTime( today, system_time, start_time )
DateTimeAdd( start_time, 1800, start_time )
JobModify( "File Watcher", "START_TIME", start_time )