Refresh Interactive Screens
Anyone know of any way to refresh an interactive screen automatically? Example.. user is sitting on a screen thet they monitor all day and can take options to orders. I want this to refresh so it updates the data all the time. Is there any "special" feature that can basically hit a function key or enter key to refresh it? The way i see it is its interactive and is relying on the user to press some key. I want to code around that if I can. Any help would be great.
Here is how I do it.
In the DDS source
Add the file level INVITE keyword.
A DSPSIZ(24 80 *DS3)
Compile the display file with WAITRCD(x) where x is the number of seconds you want to wait automatically before refreshing the screen.
In the RPG source
On the F spec for the display file add the keyword maxdev(*FILE)
You cannot use EXFMT, so you need to do a WRITE record name followed by a READ(e) file name in your do loop.
So the code would look something like this with a file called dtaqout that contains a record format named getrec.
Fdtaqoutd CF E maxdev(*FILE)
dou *in03 ;
It sitll will not work.. I got it to work with a regular screen but a subfile is where I need it to work.
For quick and dirty, just create a simple macro in i Access for Windows to automatically press the F5 key.
I woudl rather not do that. Not a fan of those kind of solutions. Thanks anyway.
I have an example of using a data queue to automatically refresh a screen without any user intervention. However, it is written in COBOL...but your more than welcome to have a copy of it...
Thanks but my COBOL is really rusty.. I probably could not even read it righ anymore...
Try these then
Thanks but I have seen those. I can get a single screen to work but not the subfile. It displays the data in the subfile just fine using the write and read method. I have the invite and all the other goodies in the program (same program that uses the regualr screen). It just will not time out and dispaly it again and again after 3 seconds like it does for the regualr screen. I have complied the screen with a 3 second timeout. There has to be something I'm missing. It does not seem that hard...lol
For some strange reason that I have never managed to find an explanation for, the method I suggested yesterday does not work with subfile displays. You didn't mention it was a subfile program, otherwise I would have suggested this method instead.
The last article cited by SPITCHER http://www.itjungle.com/mpo/mpo081502-story06.html does what you want. It allows input to your program from the screen and from a data queue at the same time. You will need to ammend your subfile program to call the QRCVDTAQ API and add some code to rebuild or update the subfile when data is received from the data queue.
I suggest creating a trigger program on the file or files that hold the order data. When the data in these files is changed, have the trigger program write an entry to a data queue. This data queue has been attached to the display file of the subfile program at compile time or using the CHGDSPF command. Then have the subfile program use whatever data sent to the data queue to rebuild or update the subfile without user input.
When I used this technique, I sent the order number to the data queue. My program updated the subfile when existing order details had been changed. I rebuilt the subfile if an order had been deleted, completed or new details were added to an existing order.
At the site I coded this for, there was only one person doing order entry. If your site has multiple users entering orders at the same time you will need to come up with something a bit more complex than this, but at least it is a start.
Tags for this Thread