Re:PIPE Whenever Informix
Posted in 1991
Topics: Installation, Setup & Upgrades, Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Jobs, Consulting & Announcements
> From: ingr!mendota!jerry!jerry@uunet.UU.NET > Message-Id: <9107081849.AA25352@ingr.ingr.com> > Subject: Re: Informix pipe problem and WHENEVER > In-Reply-To: <9107081625.AA22854@emory.mathcs.emory.edu>; from "Walt Hultgren {rmy}" at Jul 8, 91 12:25 pm > X-Mailer: ELM [version 05.00.01.20] > Status: R > > > Path: emory!wuarchive!uunet!mcsun!ukc!slxsys!dircon!uaa1006 > > >From: uaa1006@dircon.co.uk (Peter Miles) > > Newsgroups: comp.databases > > Message-ID: <1991Jul06.105652.26798@dircon.co.uk> > > Date: 6 Jul 91 10:56:52 GMT > > Organization: The Direct Connection, UK > > > > > > I think I may have come across two bugs in Informix 4GL, version > > 2.10.3F... > > > > First, I'm using the REPORT TO PIPE feature, to pipe output > > to a pager (less, in fact). The problem here is that if I quit > > from the listing (using less's q command), I am not returned > > to the 4GL program, but am returned to the UNIX $ prompt. > > I don't know what less's q command is maybe this is your problem ???? > > > > Interestingly, if I view the complete output of the REPORT (until > > less says END), and then I quit from less, I get returned correctly > > to the 4GL program. I presume the problem is something to do > > with the pipe from the 4GL program being closed by less when > > I type 'q', and Informix cannot handle this properly. Is there > > a workaround for this? > Im working currently with 4.0 > I have had problems with this also but after a little time I have > got this to work. > > I put this function in my main and I call this in my page trailer > > the variable rpt_c is global defined > > function c_waitcr( ) > define > rrwait char( 1 ) > > prompt "Press q to quit, any other key to continue. "attribute(cyan) > for char rrwait > if ( rrwait matches "[qQ]" ) then > let rpt_c = 1 > clear screen > return > end if > clear screen > let rpt_c = 0 > return > end function > > In the report module use this type of checking > before group of d_eqp.lan > if rpt_c = 1 then return end if > skip to top of page > > after group of d_eqp.lan > if rpt_c = 1 then return end if > PRINT COLUMN 37, "TOTAL BMC AMOUNT FOR THIS CUSTOMER IS: ",bmtot USING "<<<<<<&" > need 1 lines > PAGE TRAILER > if rpt_c = 1 then return end if > call c_waitcr() > clear screen > display "" > end report > The problem is that the report will always try to finish > or do after group etc. With this checking it will return back > to the calling module. I don't know what you were using to return > I hope not exit. > start report example to pipe "print.sh" > foreach t_cur into t.* > output to report example () > if rpt_c = 1 then let rpt_c = 0 exit foreach end if > end foreach > finish report example > > > > The second bug is to do with the WHENEVER ERROR statement. I'm > > using this to trap for errors and then GOTO my program's main > > menu (ie WHENEVER ERROR GOTO start_again). This statement appears > > in the MAIN part of the program and is after the LABEL start_again > > has been defined. The structure of the program is below: > > > > MAIN > > > > DEFINE vars > > > > LABEL start_again: > add this > if status <> 0 then > whenever error continue > put err messages etc > whenever error stop > end if > > the whenever statement is a run time switch if you do not > turn it to stop or continue it will try to loop on itself > this type of syntax above will work > > > WHILE TRUE > > > > WHENEVER ERROR GOTO start_again > > display menu, accept input CALL functions > > > > END WHILE > > END MAIN > > > > When I compile the program, the 1st and 2nd compiler phases > > proceed OK, but when it gets to the 3rd one, it aborts. In the > > .err file, it says: > > > > prog.ec(727) : error C2094: label 'start_again' was undefined > > > > This line is repeated six times, with different numbers (line > > numbers?) appearing in the brackets after the program name. > > > After each statement in the c code it puts a goto statment > to your assigned label. The same thing happend to me Your right > I think it's a bug but using another whenever statment in your > label will get around it. Further the whenever statment only applies > to the curent module, in your example it would work for the main > and then would convert to whenever stop for the called function > so you need to do these statments in every module. Beware during > Input Array Or Display Array statments you must terminate these first > before returning > > > If I remove the WHENEVER statement from the program, it compiles > > fine (even though I leave the LABEL start_again in the file, > > and use it elsewhere with a straight GOTO statement). > > This looks like a bug to me...any workarounds for this one? > > The program will do the statments in a label if it steps through > them that is the reason for the if status statment > > > > Thanks for your help. > > > > -- Pete > > > > PS: Please don't suggest we upgrade to version 4! We just heard > > from Informix UK, that this would cost over $3,000, just for upgrading > > 4GL. As we also use isql and esql, this would be far too much > > for my employers (probably cheaper to buy the whole lot new). > > -- > > Pete Miles uaa1006@dircon.co.uk > > ...ukc!dircon!uaa1006 > > > > > Jerry Jugovich > uucp!ingr!mendota!jerry!jerry > Intergraph > Mendota Heights Minnesota >