Discussion:
Enform related
(too old to reply)
Pradeep Kumar
2021-03-26 14:14:26 UTC
Permalink
Hi
Can we write enform in which the data comes in real time and continues until we stop . any idea

Kumar
Keith Dick
2021-03-26 15:35:21 UTC
Permalink
Post by Pradeep Kumar
Hi
Can we write enform in which the data comes in real time and continues until we stop . any idea
Kumar
I do not recall any option in Enform that offers that capability.

The only approach that occurs to me is that if Enform can accept a process name as its data file, then you probably could write a process that reads the data file you are interested in and uses the records read from the data file as the contents of replies to $RECEIVE. This program you would write could react to getting EOF on the data file by pausing for a short time, then trying to read from the data file again.

Writing that program would be pretty simple for anyone who is familiar with writing a server program -- there just would be no data in the "requests" it reads from its $RECEIVE. The thing I don' t know is whether ENFORM would accept a process name for its data file.

If ENFORM does not accept a process name for its data file, going further into speculative territory, it might be possible to have that program that you would write make use of the feature that allows it to receive and respond to DEVICEINFO requests to get it to respond with the device type of a disk file (or some other device type that ENFORM would accept). I don't remember whether that device type masquerading feature allows a process to pretend to be a disk file.
Henrik Paludan-Mørk
2021-04-05 18:43:05 UTC
Permalink
Post by Pradeep Kumar
Hi
Can we write enform in which the data comes in real time and continues until we stop . any idea
Kumar
Hi Kumar.
i think you will not have success with this approach. Rather, you might want to look into writing a report program that uses the ctrl-27 faciities to "wake up" when a file is changed. that way, you can continouosly write from the file, even if it is still being written.

//Henrik P
Keith Dick
2021-04-05 19:51:34 UTC
Permalink
Post by Henrik Paludan-Mørk
Post by Pradeep Kumar
Hi
Can we write enform in which the data comes in real time and continues until we stop . any idea
Kumar
Hi Kumar.
i think you will not have success with this approach. Rather, you might want to look into writing a report program that uses the ctrl-27 faciities to "wake up" when a file is changed. that way, you can continouosly write from the file, even if it is still being written.
//Henrik P
If you are willing to write a non-Enform report program, I believe it is not necessary to utilize the Control 27 feature in such a program to make it work well. A simple approach of delaying a short time when the read of the next record from the input file returns the EOF status code, then trying to read from the input file again should work very well. Making the delay time be some constant value around 0.1 second to 1 second probably would work well, and would be very simple to implement.

If you find that checking for a new input record that frequently when no new data is arriving puts more of a load on the system than you want to accept (I kind of doubt that would be a problem), it is not very much more complicated to make the delay time start as, for example, 0.1 second, and if you get EOF for 5 consecutive read attempts, switch the delay time to a larger value, perhaps 5 seconds or 10 seconds. That should reduce any system load from polling for new input to a completely insignificant level. (If you take the adjustable delay approach, be sure to set the delay time back to the low value whenever you have a read that actually returns a record rather than EOF).

There certainly are use cases where Control 27 is very useful. However, I don't believe this is one of them..
Continue reading on narkive:
Loading...