|
Robert Munday wrote:
In a program code review of some programs I inherited, I have been asked to replace TESTN with CHECK. I'm all for being modern, but it there a reason this has been requested? Performance or personal preference on the part of the requester?
It depends what the TESTN is being used for. TESTN would give the same results for '12345' and '1234N' ('1234N' is the character form of zoned -12345).
If you want to verify that the character field contains a valid zoned numeric value, then TESTN is best. It would be difficult to use CHECK for that, since you would have to allow a few non-digit characters, but only in the last position.
If you only want to accept '0' - '9', then CHECK is best. If you use TESTN for that, you have to do a separate check on the last character to make sure it's a numeric character.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.