Larry,
Have a read on this thread topic. I know it has INVITE, which
you say you do not like but not why. It uses the DTAQ parameter of the
display file.
http://archive.midrange.com/rpg400-l/199911/msg00419.html
Thanks, Matt
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[
mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Larry Ducie
Sent: Monday, April 23, 2007 6:04 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Getting a program to move off an EXFMT (or READ) without using
INVITE
Hi chaps,
Is there a way (API or set of APIs) that allow you to move a program
from an
EXFMT without requiring the device to send data? I am aware of the
INVITE
keyword, but for many reasons I do not want to use it.
Currently, I have written some software that allows me to refresh the
screen
whenever I need to, but I would like a more gracious way to do it..
It works like this (simplified):
------------------------------------------------------------------------
----
----------------------------------------------
init - enable signals, set a handler sub-proc for sigalarm signals.
dou f key pressed or whatever
prepare the screen (load subfile, etc)
call sub-proc to set an alarm in 1 second (send a signal via a call to
alarm() )
exfmt(e) the screen
call sub-proc to disable the alarm (call alarm(0) )
if %error and sds_excpid = MY_ALARM_ERROR
close display file
open display file
endif
process F keys
process entered data
enddo
The handler sub-proc checks some values and if the screen requires
refreshing it sends an *ESCAPE message to the program - this pops the
screen
off the exfmt(e) and resets the screen - nothing pressed/ entered so the
screen loop causes the screen to be rebuilt and redisplayed. If it is
not
necessary to re-display the screen the sub-proc sets the alarm to go in
another second, as so on...
------------------------------------------------------------------------
----
----------------------------------------------
The benefit of this is that I only refresh the screen if something
changes
before the user presses a valid F key or presses Enter. So in most cases
it
is just like any normal screen process. However, I just don't like
having to
use an *ESCAPE message to pop the screen off the EXFMT. The program
still
thinks the device is waiting for input so I can't write to the display
file
without closing and re-opening it - major drawback. Mostly it doesn't
matter
because this technique would only be used on front-end screens anyway.
It
does work like a charm though. The screens refresh really well, but only
when they need to. A guy here has written a cool demo chat application
based
on it - google chat in RPG - who'd have thunk it! :-)
So, any ideas if there is a workstation API that will knock the program
off
the EXFMT without putting the display file or device into an error
state?
Your help would be appreciated.
Cheers
Larry Ducie
As an Amazon Associate we earn from qualifying purchases.