Operating System - OpenVMS
1753566 Members
5679 Online
108796 Solutions
New Discussion юеВ

Submiting a batch job to run automatically twice a year

 
SOLVED
Go to solution
labadie_1
Honored Contributor

Re: Submiting a batch job to run automatically twice a year

If you do not have to submit too often, may be a simple solution is to put the dates in the dcl
and from time to time update the command file.

You do not need to resubmit it, just do, if your command file is a.com, after modfying it
from a.com;1 to a.com;2

$ copy/overlay a.com;2 a.com;1

and the "new" a.com will be used for the next submit.
Robert Gezelter
Honored Contributor

Re: Submiting a batch job to run automatically twice a year

Jan,

Indeed, I mis-spoke[sic].

The second Friday of the month ranges from the 9th (when the month starts on a Thursday), to the 15th (when the month starts on a Friday).

(smile) Obviously, one needs to exercise caution when dealing with the fourth and fifth weeks of the month.

- Bob Gezelter, http://www.rlgsc.com
Robert Gezelter
Honored Contributor

Re: Submiting a batch job to run automatically twice a year

To all,

My apologies, this does not seem to be my day for calendars.

The lowest day of month for the "second Friday" is the 8th (if the month starts on the previous Friday). The highest day of month is the 14th (if the month started on a Saturday).

My apologies for the errata.

- Bob Gezelter, http://www.rlgsc.com
Robert Gezelter
Honored Contributor

Re: Submiting a batch job to run automatically twice a year

Steve,

The "trick" to get the last day of the month is to use "one day before the start of the next month", to wit:

$ LASTDATE = F$CVTIME("1-MAR-2008-1-0",,"DATE)

Yields 29-Feb-2008. Note that this automatically deals with leap years.

- Bob Gezelter, http://www.rlgsc.com
John Gillings
Honored Contributor

Re: Submiting a batch job to run automatically twice a year

There are numerous potential problems with having jobs submitted into the "distant" future (more than say, 1 month).

As others have suggested, I find you're much better off having the job execute frequently (daily is easiest) and checking on each run if there's anything to be done.

A few tricks to make coding easier and clearer...

For a job that should do something each week day:

$ SUBMIT self for tomorrow
$ GOTO 'F$CVTIME(,,"WEEKDAY")
$
$ Saturday:
$ Sunday:
$ EXIT
$
$ Monday:
$ Tuesday:
$ Wednesday:
$ Thursday:
$ Friday:
$ ! Do work here

Obvious modifications for doing different things on specific weekdays.

For first of the month:

$ IF F$CVTIME(,,"DAY").EQS."01"
$ THEN
$ ! Today is first of month
$ ENDIF

For last day of month

$ IF F$CVTIME(,,"MONTH").NES.F$CVTIME("+1-",,"MONTH")
$ THEN
$ ! Today is last day of month
$ ENDIF

For a calendar of arbitrary dates, store them in a file:

$ PIPE SEARCH ACTION_DATES.DAT "''F$CVTIME(,"ABSOLUTE","DATE")'" >nl: 2>nl:
$ IF $SEVERITY.EQS."1"
$ THEN
$ ! today is listed in ACTION_DATES.DAT
$ ENDIF
A crucible of informative mistakes
Steve ward_3
Advisor

Re: Submiting a batch job to run automatically twice a year

Can someone just give me a simple if then else command to achieve what I am looking for.

I want to be able to execute a job that will check for a certain date and if it is that date to submit it automatically.

Let's say i want this job to run on the 2nd week on a particular day {tuesday) in June and then again in Decemember?

Is there a simple DCL command to do this, without making it too complicated!

Ex.

Maybe something that says

if today is the 14th of june or Decemeber and the day is tuesday then submit this job?

Something to that effect?

Just want somethinmg simple if at all possible.

Thanks!
Steven Schweda
Honored Contributor

Re: Submiting a batch job to run automatically twice a year

> Can someone just give me a simple [...]

Perhaps, but I doubt it.

> [...] check for a certain date [...]

I think that that's been provided already.

> Let's say i want this job to run on the 2nd
> week on a particular day {tuesday) [...]

No problem. Define "2nd week".

> Just want somethinmg simple if at all
> possible.

A clear, unambiguous description of the
problem can be a big help. I haven't seen
one yet. Some thought may be required. Get
used to it. If you can't specify the problem
clearly enough for someone else to do your
job for you, then you may need to do some
playing around with the suggestions you get,
to see if you can adapt the concepts to
whatever it is that you actually want to do.

Am I being too grumpy again?
Steve ward_3
Advisor

Re: Submiting a batch job to run automatically twice a year

The com file is out there but for some reason it doesn't execute the submit command when it does find it??

Am I missing something?

$ if (f$search("steve_ward:'node'_ward.com") .eqs. "")
$ then
$ write sys$output "WARD.COM file missing! Program will NOT run."
$ goto the_end
$ else
$ SUBMIT/NOPRINT/QUE=SYS$BATCH/LOG=STEVE_WARD:[000000]'node'_WARD.COM
Jan van den Ende
Honored Contributor

Re: Submiting a batch job to run automatically twice a year

Steve,

>>>
if (f$search("steve_ward:'node'_ward.com") .eqs. "")
<<<
Is this an exact copy/paste, or a nearly accurate attempt to re-type?

It SHOULD be (and for clarity I added spaces, which do NOT belong!)
if (f$search(" steve_ward: ' ' node ' _ward.com") .eqs. "")

Notice: Between double quotes, you need TWO apostrophes to begin synbol substitution, and one to end it.

And why do you f$search
"steve_ward:'node'_ward.com")
but if you find it, you SUBMIT
>>>
STEVE_WARD:[000000]'node'_WARD.COM
<<<
It will work a lot better of you SUBMIT STEVE_WARD:'node'_WARD.COM

Explanation:
In the search, STEVE_WARD obviously is a logical name for a directory (or you would not find anything)
But in STEVE_WARD:[000000] you specify a DEVICE )potentially a Concealed Device) named STEVE_WARD; which has a top-directory [000000] (for concealed devices that would be the pseudo directory, pointing to the root level itself), where the .COM file should reside.
But, STEVE_WARD can NEVER be simaultabiously both a Device spec AND a Directory-spec.

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Jan van den Ende
Honored Contributor

Re: Submiting a batch job to run automatically twice a year

Duh

>>>
simaultabiously
<<<

read that as simultanously

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.