1 / 16

Chapter 11

Chapter 11. Data Validation. Question. Should your program assume the data is correct, or should your program edit the data to ensure it is correct?. Why Input Must Be Validated. Risk of data entry errors is high Large volume of data entered Human error keying in data

Télécharger la présentation

Chapter 11

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 11 Data Validation

  2. Question • Should your program assume the data is correct, or should your program edit the data to ensure it is correct?

  3. Why Input Must Be Validated • Risk of data entry errors is high • Large volume of data entered • Human error keying in data • Invalid input leads to inaccurate output • For example, salary reported incorrectly if entered as 23000 instead of 32000 • Input error can cause program interrupt • For example, spaces entered for numeric field used in arithmetic operation

  4. Data Validation Techniques • Routines to identify various types of input errors • Error modules to handle each error that occurs

  5. Data Validation Techniques • Test fields for correct formatNUMERIC or ALPHABETICSign test • Checking for missing data • INSPECT statement • Testing for reasonableness

  6. Checking for missing data • Check key fields if they must contain data If Soc-Sec-No = Spaces Perform 900-Err-Rtn End-If Example

  7. INSPECT Statement • Useful for validity checking as well as other purposes • Two main functions • To count number of occurrences of given character in field • To replace specific occurrences of given character with another character

  8. INSPECT … TALLYING Move Zeros To Ct1, Ct2, Ct3 Inspect X1 Tallying Ct1 For All Spaces Inspect X2 Tallying Ct2 For Characters Inspect X3 Tallying Ct3 For Leading Zeros FieldsResults X1 = bb82b Ct1 = 3 X2 = AB32C Ct2 = 5 X3 = 00060 Ct3 = 3 Examples

  9. INSPECT … REPLACING • To replace specified occurrences of a given character with another

  10. INSPECT … REPLACING Inspect Date-In Replacing All '-' By '/' Inspect SSNo Replacing All Spaces By '-' FieldBeforeAfter Date-In 10-17-02 10/17/02 SSNo 123 45 6789 123-45-6789 Examples

  11. Testing for Reasonableness • Use after verifying that numeric fields contain numeric data • Range test - check that field is within established lower and upper bounds • Limit test - check that field does not exceed defined upper limit

  12. Actions If Input Errors Occur • Print error record displaying key field, field in error and error message • Stop the run to preserve data integrity • Partially process or bypass erroneous records • Stop the run if number of errors exceeds predetermined limit

  13. Actions If Input Errors Occur 5. Use switch or field to indicate when record contains error • Initialize field to 'N' for no errors • Set field to 'Y' anytime an error occurs • Process record as valid only if switch field still 'N' after all validation checks

  14. Actions If Input Errors Occur • Print count totals and compare to manual counts • Print count of all records processed • Print count of all errors encountered • Print batch totals or count of all records within specific groups or batches

More Related