HP OpenVMS Systemsask the wizard |
The Question is: I like to run a batch job Friday every four weeks. I would submit a job whenever i=0; i = mod((N-n),28) where N is today's Julian calander day dount, n is the Julian calendar day count of the first friday. How can I get the Julian calenday day count form the MVS time and is there a DCL modulo operator? The Answer is :
DCL does not have particularly elegant mechanisms for manipulating
dates and date values -- it is often easiest to submit the job more
often than it is needed, and have the job detect and exit (after
immediately resubmitting itself for the next interval via, say,
$ SUBMIT/AFTER="+28-") when the job is not needed. This means that
a natch job that is self-resubmitted daily (SUBMIT/AFTER=TOMORROW)
can perform one set of actions on most days, and can be coded to
perform another set of tasks on a specific day of the week (or
month, etc).
For a tool that directly works with the Julian day (via the lib$day
RTL call and DCL symbols), please see the DSBD tools in the area:
http://www.hp.com/go/openvms/freeware
Look in the SRH_EXAMPLES area available on several of the Freeware
releases.
If you have a scheduled daily batch job, and want to determine the
day number in the current year, then you could use a DCL sequence
such as the following:
$ if p1 .eqs. ""
$ then
$ now = f$time()
$ else
$ now = p1
$ endif
$ month= f$integer(f$cvtime(now,,"MONTH"))
$ year = f$integer(f$cvtime(now,,"YEAR"))
$ if f$integer(f$cvtime("28-FEB-''year'+1-",,"MONTH")) .eq. 2
$ then
$ ! Specified date is a leap year...
$ days="0,0,31,60,91,121,152,182,213,244,274,305,335"
$ else
$ ! Specified date is NOT a leap year...
$ days="0,0,31,59,90,120,151,181,212,243,273,304,334"
$ endif
$ julianday = f$integer(f$element(month,",",days))
$ julianday = julianday + f$integer(f$cvtime(p1,,"DAY"))
$ show symbol julianday
Note that:
$ if f$integer(f$cvtime("28-FEB-''year'+1-",,"MONTH")) .eq. 2
can be shortened to:
$ if f$integer(f$cvtime("28-FEB-''year'+1-",,"MONTH"))
Now as to why this particular command and this command construct will
work in this context, that is left up to the reader.
|