Re: field validation (was Re: COBOL/DB2 Date edit question)



On Tue, 14 Aug 2007 16:57:43 +0300, Binyamin Dissen
<postingid@xxxxxxxxxxxxxxxxxx> wrote:

There are two kinds of validations, syntax and appropriateness.

An amount must be numeric (syntax) and be within a certain range
(appropriate).

February 30th fails on syntax, while Mar 23rd may fail due to being in the
wrong quarter, or wrong day of the week.

Quite often I see syntax checking of a date that is really a waste of
resources - when it is followed by appropriateness checking that will
fail it anyway.

Part of this is our CoBOL background, where we check to see if a
denominator is zero before we do division, because that is easier than
handling the error if it is zero. (Even if we expect that the number
isn't zero). All the checking ahead of time every time uses up
resources that aren't needed with good exception handling.

An other edit is the inappropriate edit - when I enter my 9-digit zip
code on a web page and the program tells me to enter my zip code
correctly. This is especially irritating when the database can
accept any sized postal code (handling foreign postal codes), but
notices that I'm from the U.S., so I must not know my 9-digit zip
code.

Why are they counting digits? Because editing is Right and Proper?
.



Relevant Pages

  • Re: File IO-I am defeated!
    ... So add some code to trap the error and have the error routine run the code I posted in my last response, except change my code so that it send its output to a log file instead of to a ListBox. ... You are telling us that these files contain only "standard text characters", and that you have produced them using your own code so you are certain you are correct. ... Your own code will happily load a file containing whatever bytes values you wish, whether they are what you would call standard text characters or not, EXCEPT it will fail with exactly the error you describe if there is a Chror a Chranywhere in the file. ... I would bet my bottom dollar that when you eventually get the log back from the faulty file you will find at least one of those characters in there, most probably the zero. ...
    (microsoft.public.vb.general.discussion)
  • Re: INVALID_HANDLE_VALUE vs. NULL
    ... 0 (zero) can never be a valid handle value. ... Of course, ReadFilewill fail with this handle, ... > CloseHandle() does indeed fail when given a bad handle. ... > case it raises an exception. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: INVALID_HANDLE_VALUE vs. NULL
    ... > On any NT-derived platform, 0 (zero) can never be a valid handle value. ... Of course, ReadFilewill fail with this handle, ... > CloseHandle() does indeed fail when given a bad handle. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: quality control
    ... Almost always, zero. ... will be, on the average, only 1 bad item in 100 samplings -- ... You expect 1 failure in 10,000. ... I'm thinking with the binary outcome of fail/not fail, ...
    (sci.stat.math)
  • Re: no-fail guarantees?
    ... irrelevant since error handling is not bug handling. ... For example the win32 function WaitForMultipleObjects can fail due to ...
    (comp.programming.threads)