Re: 4GL monitoring program
Posted in 1997
Rob Prop wrote: > > Does anybody know how to make user-interaction possible in Informix 4GL > without waiting for the user to press a key. My goal is to create a > monitoring program that shows the number of open sessions, locked > records and so on from the systmaster database. > It must also retrieve status information from the application > database. The monitoring screen consists out of several windows. > Now the data shown is always the same, and the program runs in a loop > with a sleep command in it. Because I cannot show all the information > on the screen, I want to give the user the possibility to change his > view. Therefore I need the user interaction in a loop without waiting > for it. In other languages such as pascal this is not a problem but how > can I solve this problem in Informix 4GL. We have 4GL version 6.04. Two solutions. The first is simpler and will work in DOS (you did not list your platform), the second is more elegant and will not use system resources polling the keyboard. 1) Write a 4GL callable function in "C" (check the manual it is not hard) to poll the keyboard and call it periodically throughout your code or from an alarm timeout signal handler. -or- 2) Write a "C" program that blocks on a select() call to check stdin for activity. If keystrokes are available select will return & the program can send a signal to its parent process. Then start that program from the 4GL master program in the background and set up a signal handler (in "C") for the signal from the monitoring child process. On receiving the signal set a global variable that can be checked from 4GL and if the global is set read the keyboard and prompt the user for any additional info that you need. Art S. Kagel