Presentation is loading. Please wait.

Presentation is loading. Please wait.

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?

Similar presentations


Presentation on theme: "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?"— 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 1.Test fields for correct format NUMERIC or ALPHABETIC Sign test 2.Checking for missing data 3.INSPECT statement 4.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

9 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 = bb82bCt1 = 3 X2 = AB32CCt2 = 5 X3 = 00060Ct3 = 3 Examples

10 INSPECT … REPLACING To replace specified occurrences of a given character with another

11

12 INSPECT … REPLACING Inspect Date-In Replacing All '-' By '/' Inspect SSNo Replacing All Spaces By '-' FieldBeforeAfter Date-In10-17-0210/17/02 SSNo123 45 6789123-45-6789 Examples

13 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

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

15 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

16 Actions If Input Errors Occur 6.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


Download ppt "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?"

Similar presentations


Ads by Google