Scott, can you post a sample of this code.
Michael Smith
Certegy, Inc.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Tuesday, September 09, 2008 1:39 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Question about opening and closing files
Hi Lim,
Are you saying that the alarm() api can actually wake up an in-active
program (ended with *inlr = *off)? That would be cool if this is true
:).
Yes, any signal (not just alarm) can be sent to code that's activated,
but dormant, in a job.
Personally, I have a program that does this. It runs as the user's
initial program when they sign on, and it sets up a signal handling
procedure for the SIGALRM signal, and installs an interval timer (with
the setitimer() API) to send SIGALRM every 60 seconds. (It also
registers a procedure to disable the timer when the activation group
ends.) The program then ends (I can't remember whether LR is off,
though... LR really has little to do with it, since it was compiled with
DFTACTGRP(*NO))
This program runs in it's own activation group, and the subprocedure
(the signal handler) wakes up every 60 seconds to check if there are new
EDI orders (Which is the purpose of this particular program). If there
are, it interrupts the user's 5250 session to tell them about the new
EDI orders. (it pops up a "window" so to speak)
If I want to disable this program, I simply reclaim the activation
group, since it runs in it's own AG, that won't affect anything else.
Anyway, while AG remains the loaded, the signal is still sent every 60
seconds, and it still runs the procedure, even after the program has
ended. The user can still run other things, and go about their work,
without even really knowing that it's there and running (until the
message pops up telling them about the new EDI orders, that is.)
Of course, if I had to do it over again, I'd probably use a Windows
program instead of a green screen RPG one, I'd just load it in the
system tray on their desktop... That makes more sense today, since I'm
trying to avoid writing more green screen apps, and hopefully they will
eventually reach a point where they don't sign on to 5250...
But, the point is... it's certainly possible to keep an RPG program
running in the background via signals.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
_____________
The information contained in this message is proprietary and/or confidential. If you are not the
intended recipient, please: (i) delete the message and all copies; (ii) do not disclose,
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition,
please be aware that any message addressed to our domain is subject to archiving and review by
persons other than the intended recipient. Thank you.
_____________
As an Amazon Associate we earn from qualifying purchases.