Discuss (10 posts)
MC Press Web Site Staff
Feel Constrained!
Oct 08 2007 16:35:00
This is a discussion about Feel Constrained!.

Click here for the article.

#150490
Feel Constrained!
Aug 01 2007 15:05:00
I'm just starting to use SQL and navigator and have just finished an application with some basic constraints. Finding a good way of trapping constraint errors has eluded me until I read this. Thanks Paul for the great article. Slainte!
#150491
P.Tuohy
Feel Constrained!
Aug 01 2007 16:17:00
Fluent Irish will always gain you brownie points :-) Slainte back at you
#150492
isdpgmr
Feel Constrained!
Aug 01 2007 19:10:00
Paul, In the Modernizing Database Access redbook, SG24-6393-00, it states "constraint violations are reported as soon as the first violation is encountered. Therefore, if you need to validate an entire panel of information and report all errors to the user, checking for constraint violations in your application could be tricky". From this statement, I gathered that if you did not include business rule validations and only trapped constraint errors in your program, you could potentially put your user in the frustrating position of fixing only one error per submit cycle. Am I misinterpreting how the constraint violations are reported to the program or are check constraints better thought of as adding suspenders to our application databases? Good article, looking forward to many more!
#150493
David Abramowitz
Feel Constrained!
Aug 01 2007 21:00:00
Constraints can lead to misleading results. Some time ago I tried to implement constraints for a client who was using standard (not ILE) COBOL programs. Constraint violations were reported to the job log, but no indication that an error had occurred was evident in the operation of the program. The program continued as if nothing had happenned, and for a short time the data was fouled up. Dave
#150494
P.Tuohy
Feel Constrained!
Aug 02 2007 06:16:00
Hi Brian, No, you are not misinterpreting how constraint violations are reported to a program. If you have three constraints defined for a table and the first constraint fails then the other two are not checked. So, there is that potential for putting users in a frustrating position but there are a couple of points to ponder... 1. Remember that a check constraint can actually perform multiple checks e.g. FLDA<>'' and FLDB<>'' and FLDD>FLDC 2. I'm not that sure about how frustrating the one error per submit cycle is anymore (the "anymore" being the important point here). I think a lot depends on the interface you are using. If it is green screen then there is more potential but if it is GUI there is less e.g. on green screen you enter a value of Y or N but on a GUI interface there is a radio button for Yes or No. Or, to put it another way - the interface doesn't give you the option of entering an incorrect value.
#150495
P.Tuohy
Feel Constrained!
Aug 02 2007 06:37:00
Hi David, I don't think it is a case of "Constraints can lead to misleading results" but more a case of "Programs that ignore un-handled errors can lead to mis-leading results". I think you will find that not just constraints would have been ignored but maybe any "new" database features (e.g. a failing trigger program). I'm afraid that COBOL is so far in my past that I have no clear memory of how exception/error handling works II vaguely remember a technique used in a COBOL application but that doesn't count for much). Anyhow, the fact that the message is in the joblog indicates that the error/exception message was sent to the program. My guess is that the program was trapping exception/errors but only looking for specific failures and ignoring all others. I guess the question is "Is this standard for COBOL programs" - I think we need input from someone more knowledgeable than I in COBOL :-)
#150496
David Abramowitz
Feel Constrained!
Aug 02 2007 09:20:00
I/O errors are determined by file status codes within a COBOL program. A status code of "00" indicates normalcy. Unless there is another type of error, a constraint violation will not affect the status code. The INVALID KEY, and AT END clauses are not affected by a constraint violation even if the constraint is a unique key constraint. There is a section which may be used to trap errors, but this too will not be affected by a constraint violation. Dave
#150497
Feel Constrained!
Oct 08 2007 16:27:00
#150498
Feel Constrained!
Oct 08 2007 16:35:00
Yep...trying to add a constraint to a green screen program. The program validates each screen when the user pressed ENTER. Thus, it was easy to test that FieldA = 'Y' or 'N' and stop the user from proceeding to the next screen. Now the Constraint test is only done when UPDATE or WRITE happens. By then the user may have filled out several screens of data. Is there a way to check constraints before allowing the user to go to the next screen. Or do I hard code logic that takes the user back to the screen in error and displays the error?
#150499

Discuss...
User Rating: / 0
PoorBest 

WHITE PAPERS

The following White Papers can be found at the MC White Paper Center

 

 


   MC-STORE.COM