COBOL and exceptions (was: Passing an invalid date to INTEGER-OF-DATE
- From: "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx>
- Date: Tue, 24 May 2005 20:14:10 GMT
There was a lot of discussion as to whether or not the '89 Amendment should have
been passed with no method for detecting argument errors. The first draft DID
include returned-values to indicate "problems" - but as some functions could
have invalid arguments but NO returned value was always "invalid" this was
(eventually) rejected.
The '02 Standard (as Chuck indicates) did introduce a "Common Exception
Handling" facility that was intended to provide a "common" solution to ALL of
the exceptions mechanisms previously available - as well as for some things
(like "incompatible data" and invalid arguments) for which NO mechanism
previously existed.
The most controversial part of this proposal (now standard) was whether
detection should be "inline" (IF right after the exception) or out-of-line
(declaratives). The Standard went with the latter *and* provided a "RESUME"
statement that let you restart at a few "selectable" places. This requires
"totally UN-structured" code and is still (at least a little) controversial.
HOWEVER, and this is a BAGGIE !!!!
I know of NO vendor who has actually implemented the '02 Standard "common
exception handling" specification (much less implemented it completely). I have
heard (unofficially) from some vendors that they have ZERO intention of ever
doing so - even if they did everything else in the '02 Standard. At least one
vendor has adopted a C-like "throw/catch" (or whatever C uses) facility.
The good news (related to the initial thread) is that the '02 Standard also
introduced some TEST-xxxx intrinsic functions that allow a programmer to
"validate" arguments for a number of other intrinsic functions and to determine
why they are invalid (if they are). I don't know which vendors (if any) have
implemented these, but I have heard more positive feedback about them - than for
the entire "common exception handling" model.
P.S. For those used to other environments, the Common Exception Handling
facility is similar (not identical to) the PL/I "ON-unit" facility and/or the
(IBM CICS) EXEC CICS HANDLE CONDITION facility.
--
Bill Klein
wmklein <at> ix.netcom.com
"Chuck Stevens" <charles.stevens@xxxxxxxxxx> wrote in message
news:d700q2$b7s$1@xxxxxxxxxxxxxxxxxxxxxxx
> I'm not convinced ON ERROR is necessarily the best approach here, or for
> that matter in general, particularly given the ability to "nest" function
> calls.
>
> The '02 standard includes exception handling (for this and in general) in a
> way that, in my opinion, doesn't invalidate existing programs and allows
> their enhancement to catch such problems. Lobby your vendors!
>
> -Chuck Stevens
>
> "Howard Brazee" <howard@xxxxxxxxxx> wrote in message
> news:d6vutt$3fp$1@xxxxxxxxxxxxxxxxxxxxxxx
>>
>> On 24-May-2005, "Chuck Stevens" <charles.stevens@xxxxxxxxxx> wrote:
>>
>> > Note that Unisys MCP COBOL85 gives a zero response to an INTEGER-OF-DATE
>> > call in which any part of the argument is incorrect -- for example,
> 20050532
>> > and 20051324 will both return zero.
>>
>> IMHO, the biggest weakness in the CoBOL language is that it was not
> designed for
>> easy standard error handling. This particular solution is easy, but
> doesn't
>> work for all function calls. ON ERROR would have been a better
> design - as
>> a standard.
>
>
.
- Follow-Ups:
- Re: COBOL and exceptions (was: Passing an invalid date to INTEGER-OF-DATE
- From: Chuck Stevens
- Re: COBOL and exceptions (was: Passing an invalid date to INTEGER-OF-DATE
- References:
- Passing an invalid date to INTEGER-OF-DATE
- From: Walter Murray
- Re: Passing an invalid date to INTEGER-OF-DATE
- From: William M. Klein
- Re: Passing an invalid date to INTEGER-OF-DATE
- From: William M. Klein
- Re: Passing an invalid date to INTEGER-OF-DATE
- From: Chuck Stevens
- Re: Passing an invalid date to INTEGER-OF-DATE
- From: Howard Brazee
- Re: Passing an invalid date to INTEGER-OF-DATE
- From: Chuck Stevens
- Passing an invalid date to INTEGER-OF-DATE
- Prev by Date: Re: Passing an invalid date to INTEGER-OF-DATE
- Next by Date: Re: Passing an invalid date to INTEGER-OF-DATE
- Previous by thread: Re: Passing an invalid date to INTEGER-OF-DATE
- Next by thread: Re: COBOL and exceptions (was: Passing an invalid date to INTEGER-OF-DATE
- Index(es):
Relevant Pages
|
|