On Thu, 05 Jan 2012 09:47:13 -0800, CRPence <CRPbottle@xxxxxxxxx>
wrote:
Or a message queue. Both queue types support a WAIT timeout which in
some cases can almost directly replace a DLYJOB request, although with a
monitor for the timeout added; plus ensuring a destructive read [e.g.
RMV(*YES) on RCVMSG] which removes the "message" from whichever type of
queue [*DTAQ or *MSGQ] being used.
I like waiting on a data queue because WRKACTJOB shows the normal
function instead of the delay function that show with DLYJOB. And it
doesn't cause the feeling of panic of seeing MSGW! <G>
I have a standard for my never-ending jobs of creating a data queue in
QTEMP then waiting on it, 15 seconds at a time. After each wait ends,
the job checks for a controlled shutdown and ends if there is one.
If there is no controlled shutdown in progress, and if appropriate,
check a data area to see if the particular function has been requested
to run immediately. If so, reset the data area and run the function.
Otherwise check the time to see if the given function needs to be run.
For example, one job does its thing every ten minutes on the ten
minutes. So if the last digit of QMINUTE is zero, it executes the
function.
Then it does five 15-second waits on the data queue to make sure that
it doesn't execute the timed function twice in that minute (checking
after each wait for a controlled shutdown and checking the data area
to see if the function has been requested to run again immediately).
Then it does 15-second data queue waits until there is a controlled
shutdown or the last digit of QMINUTE is zero again or the data area
says to run the function immediately.
Ken
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.
As an Amazon Associate we earn from qualifying purchases.