Yes, devolved from "how to monitor EOJ for an RPG pgm" for which I still
recommend a scope msg.
I'm not going anywhere near the other discussion.
Peter
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rory Hewitt
Sent: Thursday, 21 May 2009 12:58 p.m.
To: RPG programming on the IBM i / System i
Subject: Re: Detecting that a submitted batch job is ending from w/in an
RPGprogram.
Peter,
The conversation devolved into a discussion of how best to check whether
a
particular folder in the IFS had any files in it - the OP had his NEP go
to
sleep for a set period of time (10 seconds, 30 seconds, 5 minutes,
whatever)
and then wake up and check the folder. I (amongst others) pointed out
that
unless you are able to wait for *something* to happen (and wake up when
that
*something* happens), then there will always be the problem of your
program
being asleep when you want it to wake up (in order to close down
gracefully).
Even with a scope message, if the program is 'sleeping' and won't wake
up
for a set period of time, I suspect it will remain asleep (but will then
process the message when it wakes up). In fact, if the NEP sends a scope
message when it starts running, no matter how it's eventually ended, the
program which is called as a result of the scope message will be too
late to
end the NEP garcefully... Somehow, it's the NEP itself which needs to
get a
signal sent to it saying "time to close down".
With a data queue (or using sleep with sigalarm), you can specify not
just
to wait for a *set* period of time, but wait until something happens. So
you
can wait on the data queue and if the entry is a special *CLOSEDOWN
entry,
you close down gracefully, but if it's not, then a file has been added
to
the folder (or whatever).
Most of the recent conversation is about how to trigger that something
when
a file is added to the folder.
It sounds like the RCVJRNE option might work, and you wouldn't even need
a
NEP - the processing program would simply be started when the fiel is
added
to the folder, do its stuff and then close down.
Rory
On Wed, May 20, 2009 at 5:24 PM, Peter Connell <
Peter.Connell@xxxxxxxxxxxxxxxxx> wrote:
Seems so simple to just issue a scope msg with a program name as I
mentioned and the system will automatically take care of it for you.
Peter
As an Amazon Associate we earn from qualifying purchases.