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. Weeell, you can use the old trick of using a shell return code as a parameter. This would allow you to return a numeric value from 0-255. If you want a timed response, allowing a single key entry would be easier. If you are just allowing the user to switch screens, then a value of 0-9 would be okay. You need to write a shell script like the following: -----------------(input.sh)---------------------------------- #!/bin/sh ans=0 stty -icanon stty min 0 time 20 # num seconds * 10 ans=`dd bs=1 count=1 2>/dev/null` stty icanon exit $ans ------------------------------------------------------------- Then call it as follows: ------------------------------------------------------------- DEFINE command_line CHAR(80) LET command_line = "./input.sh" WHILE ..... RUN command_line RETURNING status LET status = status/256 CASE WHEN status = 1 ..... WHEN status = 2 ..... : END CASE ... re-draw the screen or what ever..... END WHILE ------------------------------------------------------------- The time value for stty must be seconds x 10, so the example is 2 secs. The return value to 4GL must be divided by 256. If no entry is made, you will return a value of zero (0). You can replace the dd command with a standard read command. This can however be a problem to display correctly with 4GL. Hope that helps, -- Mark. +----------------------------------------------------------+-----------+ |Mark D. Stock - Informix SA http://www.informix.com |//////// /| |mailto:mdstock@informix.com FAQ http://www.iiug.org |///// / //| | +-----------------------------------+//// / ///| | Tel: +27 11 807 0313 |If it's slow, the users complain. |/// / ////| | Fax: +27 11 807 2594 |If it's fast, the users keep quiet.|// / /////| |Cell: +27 83 250 2325 |Therefore, "No news: travels fast"!|/ ////////| +----------------------+-----------------------------------+-----------+