Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Bruce F. Thatcher" <thatcher@spire.privacy.com>
Subject: Re: How do you automate a file to run every hour ?
Date: 1997/06/12	[thread overview]
Message-ID: <01bc774e$f7cea240$6a046e78@bft.spire.com> (raw)
In-Reply-To: EBMBwM.CrB.0.bloor@torfree.net


Yin Tse <cr389@torfree.net> wrote in article
<EBMBwM.CrB.0.bloor@torfree.net>...
> I'm looking into writing a com file to run every hour or so. That com 
> file will start an application which will run until it terminates.
> My question is how do you do that...

First, decide whether you want the procedure running in a batch queue (type
HELP SUBMIT for more information), or as an independent (detached) process
(type HELP RUN PROCESS for more information)?  Note that you need
specialized privileges to run a process in detached mode.

In either case, you have a couple of choices:

If the procedure doesn't have to run every hour exactly, you might
incorporate the command 
    $ WAIT 01:00:00
into the code.  The procedure would run the application, hibernate for an
hour, and then (using a GOTO loop) run the application again.

Or, you might have the procedure restart itself (using a new SUBMIT or RUN
command) at the top of the next hour.  I leave the algorithm to determine
the next hour to the reader (hint: a modification of f$cvti("+1:"...) is
probably easiest ).

There are other, more sophisticated methods that you can read about in
HELP, but these two should provide an adequate solution.

> and also how do you program it in dcl
> to let you know if the com file was not able to run the application for 
> some reason. Is there some way to know that the application crashed or 
> would not start. Thanks for the help in advance.

There is a global symbol called $STATUS that contains the status code
resulting from the last image invocation (or certain DCL instructions).  By
checking this symbol for odd (success) or even (error) after your
application terminates, you will know the status of the application's
execution.  You can check with the command
    IF $STATUS .AND. 1 THEN...   ! Success
or
    IF .NOT. ($STATUS .AND. 1) THEN ...  ! Error

Note that your DCL procedure can also return a status code by using
    $ EXIT <status-code>

Hope this helps.

===============================================================
To resist the flood of spam on the internet, I have added the string
"privacy." to my return address.  To contact me, simply remove it.

Fight net abuse!  Report ALL net abusers to their ISPs!
===============================================================




  parent reply	other threads:[~1997-06-12  4:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-11  4:00 How do you automate a file to run every hour ? Yin Tse
1997-06-12  4:00 ` Robert Koehler
1997-06-12  4:00 ` Bruce F. Thatcher [this message]
1997-06-13  4:00   ` George Cornelius
1997-06-15  4:00     ` Data64
1997-06-16  4:00       ` Ferry Bolhar-Nordenkampf
1997-06-12  4:00 ` Lynn Lantz
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox