Funnily enough I was working on something similar but not quite the same so here is something to try and see if it works for you. This should definitely work for DP 8 or above. If the date being checked is a holiday or a weekend the process will return "Process Prerequisites Failed" and the process will stop. The only way I can see of stopping a process
from running is using "return false" in the code (I think this was something that Gareth Horton posted in response to another query).
Of course you could combine the code below with the info I posted on using one process to kick off another url=http://www.monarchforums.com/showpost.php?p=9340&postcount=7here[/url] and this would result in much cleaner logging i.e no error returned as the process wouldn't even run. Just a thought.
Anyway here goes:
Step 3[/B] In your Pre Process /B tab add the following script:
Dim dtnow as datetime = Now '<current date/time
Dim holiday As Boolean = false '<default to not being a holiday
dtNow = DateTime.Parse((dtnow.day).tostring()"/"(dtnow.month).tostring()"/"(dtnow.year).tostring(), Globalization.CultureInfo.CreateSpecificCulture("en-GB")) '<force date to common format for country)
'check if weekend, if so do nothing else, if not check for holidays
If dtnow.DayOfWeek = DayOfWeek.Sunday or dtnow.DayOfWeek = DayOfWeek.Saturday Then
holiday = true
Dim objStreamReader as StreamReader '<prepare to read text file
objStreamReader = File.OpenText("C:\Data\HolidayList.TXT") '<open text file (change path to yours)
Dim line as String = objStreamReader.ReadLine() '<get first line
Do While Not line is Nothing '<loop through all holiday file lines
'if today is in holiday file do nothing else, else keep checking
if dtnow = DateTime.Parse(line, Globalization.CultureInfo.CreateSpecificCulture("en-GB")) then
holiday = true
line = objStreamReader.ReadLine()
objstreamreader.close() '<close text file
if holiday = true then '<if holiday do not run process
Log.AddEvent("Weekend or Holiday. Process Halting.")
else '<if not holiday continue with process
Log.AddEvent("Not A Weekend or Holiday. Process Continuing.")
Nice code and idea. Big problem is that all of the Non mainframe people at Hancock were let go.
Looks like the plan is to go directly from the mainframe to the web for all reportring. They have two people watching the DataPump jobs, but no development work.
Thanks again...If I get another job where they use DataPump I will try that idea.