Programming Informix 4GL: wait for event
Posted in 2009
A 4GL developer (I4GL 7.32, no add-ons) asked whether there's a better way than polling with a SELECT loop to wait up to 30 seconds for a column value to change after a RUN call. Replies offered workarounds rather than a definitive answer: log a feature request; use a small ESQL/C routine or RUN ... WITHOUT WAITING plus a SIGINT sent from the spawned program to break a sleep; wrap the task in a shell/Perl/Python script that forks and handles the timeout; or put an update trigger on the table to do the work. No single accepted resolution is recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi, i have a I4gl program that makes a RUN call and then he needs to wait for a field in a record to change is value, for a period of 30 seconds. Of course i can do a loop with a SELECT and checking the CURRENT value for timeout. There is a better way ? Restriction: is plain Informix 4GL 7.32xxx no Aubit4gl or Datablade Modules or other extras. Thanks !
eferreyra wrote: > Hi, i have a I4gl program that makes a RUN call and then he needs to > wait for a field in a record to change is value, for a period of 30 > seconds. Of course i can do a loop with a SELECT and checking the > CURRENT value for timeout. > > There is a better way ? Nope. Log a feature request. ;o) -- Cheers, Obnoxio The Clown http://obotheclown.blogspot.com -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean.
Obnoxio The Clown wrote: > eferreyra wrote: >> Hi, i have a I4gl program that makes a RUN call and then he needs to >> wait for a field in a record to change is value, for a period of 30 >> seconds. Of course i can do a loop with a SELECT and checking the >> CURRENT value for timeout. >> >> There is a better way ? > > Nope. Log a feature request. ;o) > Er, surely a little esql/c sub routine that is called by run without waiting...? -- }(:
I'm not entirely sure I understand the question... About the only thing I can think of is that if you're on unix is to fake a SIGINT (which I think will stop a 'sleep'). All you'd need to do is start your program - and in the program you RUN send the SIGINT when you're ready (assuming you've RUN .. WITHOUT WAITING).. Of course - you'd need to find the process ID to "kill()" etc - but you can probably pass that as a parameter - or use getppid() etc.. You're going to need to link some C in to use either of those - I won't mention how easy that would be to do in Aubit4GL ;-) On Friday 13 February 2009 11:46:39 eferreyra wrote: > Hi, i have a I4gl program that makes a RUN call and then he needs to > wait for a field in a record to change is value, for a period of 30 > seconds. Of course i can do a loop with a SELECT and checking the > CURRENT value for timeout. > > There is a better way ? > > Restriction: is plain Informix 4GL 7.32xxx no Aubit4gl or Datablade > Modules or other extras. > > Thanks ! > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list -- Mike Aubury http://www.aubit.com/ Aubit Computing Ltd is registered in England and Wales, Number: 3112827 Registered Address : Clayton House,59 Piccadilly,Manchester,M1 2AQ
> From: Wik.King!@yahoo.co.uk > Subject: Re: Programming Informix 4GL: wait for event > Date: Fri, 13 Feb 2009 07:56:11 -0500 > To: informix-list@iiug.org > > Obnoxio The Clown wrote: > > eferreyra wrote: > >> Hi, i have a I4gl program that makes a RUN call and then he needs to > >> wait for a field in a record to change is value, for a period of 30 > >> seconds. Of course i can do a loop with a SELECT and checking the > >> CURRENT value for timeout. > >> > >> There is a better way ? > > > > Nope. Log a feature request. ;o) > > > Er, surely a little esql/c sub routine that is called by run without > waiting...? > Huh? Ok, lets look at this... Is RUN synchronous or asychronous call? (RUN does a system() call which will execute the program name. Does it return right away or does it wait with no time out setting?) Does the OP want an asynch return from run, or does he want it to time out within 30 seconds either returning a value or nothing? You can do this by wrapping what you want to run inside a shell script, python script or perl script. There you can fork your run and have a timeout counter in a separate thread. I'd recommend the python script. Or are you looking for a form where a user has x number of seconds to enter data in to a form before he gets bumped? That would be a feature request. The feature request would be to add a timeout to RUN(). (Overload the RUN() command to allow for an optional parameter of a timeout) RUN then has the option to fork a timer and sets the timeout. If the timeout hits before the run() command returns, you end the run and return NULL. Or something to that effect. So until IBM wants to update a legacy app, I'd say go with a python wrapper. -HTH _________________________________________________________________ Windows Live™: Keep your life in sync. http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_allup_howitworks_022009
eferreyra wrote: > Hi, i have a I4gl program that makes a RUN call and then he needs to > wait for a field in a record to change is value, for a period of 30 > seconds. Of course i can do a loop with a SELECT and checking the > CURRENT value for timeout. > > There is a better way ? > > Restriction: is plain Informix 4GL 7.32xxx no Aubit4gl or Datablade > Modules or other extras. > > Thanks ! Why can't you create an update trigger on the table to perform the necessary work?