RE: A question regarding WHENEVER
Posted in 1996
Stuart, If you have 4Gl compiled, you can easily get answers to questions like this by having a look at the c code produced by c4gl. In any case, WHENEVER is just a compiler directive, so it only affects code physically placed after it in the same module, and not code from other modules being executed after it (am I clear ?!? :-) so your WHENEVER ERROR STOP will only be effective for any function following your func1. Also, note that - it makes a difference whether you place it at the end of a function or at the beginning of the next: in the first case, if you hit error -1318 (parameter count mismatch), the program will (ahem...) gracefully terminate, in the second you are very likely to get a core dump - even though it's a directive, you can only put WHENEVER within procedural code. So there's no way to prevent the entry code of the first function in a module from terminating the program in case of a -1318 error (JL, I'm ready to be corrected by you, here :-). Not that it makes a difference: if you have less parms than expected, you'll be kicked back to the shell anyway, if you have more, just wait for the TSS to clog... HTH, Marco ____________________________________________________________________________ rem radioterapia, which I immeritately manage, seldom agrees with what I say marco greco (Catania, Italy) Work: marcog@ctonline.it rem radioterapia 39 95 447828 fax 446558 (was mar.greco@agora.stm.it) Achea 39 95 503117 --- On Thu, 21 Nov 96 15:59:39 PST Stuart Knight <Stuart_Knight@lendlease.com.au> wrote: A straightforward question this one (hopefully!!): Are WHENEVER clauses interpreted, or are they compiler directives ? eg. FUNCTION func1 () WHENEVER ERROR CONTINUE processing...... RETURN TRUE WHENEVER ERROR STOP <-- Would this statement ever be acted upon ? (or should it be before the RETURN statement) END FUNCTION After asking several of my colleagues, I could not come up with a definitive answer. Any comments would be most welcome. Regards, Stuart Knight. eMail: stuart_knight@lendlease.com.au "Any opinions expressed are mine and not necessarily those of my employer" -----------------End of Original Message-----------------