Re: WHENEVER ANY ERROR
Posted in 1997
In article <yosemiteEEBxoB.5rF@netcom.com>, Alan Denney <yosemite@netcom.com> writes >In article <19970730134100.JAA12856@ladder02.news.aol.com>, >Jojean <jojean@aol.com> wrote: >>We are changing some 4GL programs to use WHENEVER ERROR to >>WHENEVER ANY ERROR. > >Good move, generally. > >> We have gotten some strange results. > >See below. > >>When we do a query if you do a previous or next and there are no more rows >>before or after the status should equal not found and a message should be >>displayed. This was working fine with WHENEVER ERROR CALL err_trap >>(err_trap is a function for capturing the errors), but when we changed the >>code to WHENEVER ANY ERROR CALL err_trap the messages "There are no more >>rows in this direction" were no longer displayed. >> >>Has any one else had a problem with WHENEVER ANY ERROR? > >Offhand, it sounds like you were depending on some sort of bug. A NOTFOUND >condition should have *no* effect in activating your ERROR action -- that's >what WHENEVER NOT FOUND is for. > >>Also when we compile the program (c4gl -c prog_name.4gl) we are getting >>the following warning message: >> >> prog_name.ec, line 524: warning: statement is unreachable >> break;}} while(0); >> > > >That's not uncommon with case statements (actual 4GL, or generated) -- the >generated code relies on gotos. (it ain't pretty, but it runs). >Menus also result in unreachable warnings on some compilers. > >If you don't have the new 4.1 and/or 6.0 4GL Supplements (1996 versions), >be sure to get them, or at least read the release notes on the ANY ERROR >issues. If it's not clear, blame the author (me)... > Ah! The author! Question: We currently write code which has to run on C4GL 4.x and 6.x. Some of our sites will not be upgraded until they move onto the "generic" version of our product (Don't ask, source code control did not exist at one point, 10 out of 15 sites have different source trees!). For version 6.x we compile with -anyerr. Will this flag always be supported? > >>If you have any input just e-mail me at jojean@aol.com. >>This is what some of the code looks like. >> (omitted) > >Well, since you have no WHENEVER NOT FOUND statement, there is no special >action that *should* occur upon a NOT FOUND condition. Try adding one >and let us know if it fails to work. > > >-- >Alan Denney This space intentionally left mispelled. >yosemite@netcom.com > -- David Williams