Chapter 8 - Data Validation

Chapter 8 - Data Validation

Chapter 8 Data Validation Data validation Incoming data must be check to avoid errors Numeric test Alphabetic test Reasonableness check Limit/Range checks number is within limits Consistency check Comparing two fields against eachother 1 Existing code check Omission errors full statements in your IFs Sequence check Incoming records are in the correct order Completeness check Makes sure that all the fields in any record contain data Date check Checks that incoming date is logical 2 The IF statement Relational condition Class test NUMERIC clause

ALPHABETIC clause Sign test POSITIVE clause NEGATIVE clause ZERO clause 3 Figure 8.1 IF The Relational Condition identifier-1 literal-1 expression-1 IS [NOT] GREATER THAN IS [NOT] > IS [NOT] LESS THAN IS [NOT] < IS [NOT] EQUAL TO IS [NOT] = IS [NOT] GREATER THAN OR EQUAL TO IS [NOT] >= IS [NOT] LESS THAN OR EQUAL TO IS [NOT] <= identifier-2 literal-2

expression-2 (a) Syntax 05 NUMERIC-FIELD PIC 9(5). 05 ALPHANUMERIC-FIELD PIC X(5). . . . IF NUMERIC-FIELD = 10 . . . IF NUMERIC-FIELD = 10 . . . IF ALPHANUMERIC-FIELD = 10 IF ALPHANUMERIC-FIELD = 10 (b) Examples (valid entry) (invalid entry) (invalid entry) (valid entry) 4 Figure 8.2 The Class Test IF identifier IS [NOT] NUMERIC ALPHABETIC ALPHABETIC-UPPER

ALPHABETIC-LOWER (a) Syntax 05 NUMERIC-FIELD PIC 9(5). 05 ALPHABETIC-FIELD PIC X(5). . . . IF NUMERIC-FIELD IS NUMERIC PERFORM D0-ARITHMETIC-CALCULATIONS END-IF. IF NUMERIC-FIELD IS NOT NUMERIC DISPLAY ERROR - NUMERIC FIELD CONTAINS INVALID DATA END-IF. IF ALPHABETIC-FIELD IS ALPHABETIC DISPLAY ALPHABETIC FIELD CONTAINS UPPER AND/OR LOWER CASE LETTERS END-IF. IF ALPHABETIC-FIELD IS NOTALPHABETIC DISPLAY ERROR - ALPHABETIC FIELD CONTAINS NON-ALPHABETIC DATA END-IF. (b) Examples 5 Figure 8.3 The SignTest identifier

IF arithmetic expression IS [NOT] POSITIVE NEGATIVE ZERO (a) Syntax IF NET-PAY IS NOT POSITIVE PERFORM TOO-MUCH-TAXES END-IF. IF CHECK-BALANCE IS NEGATIVE PERFORM OVERDRAWN END-IF. (b) Examples 6 Compound test Operators AND expression OR expression NOT expression Precedence of operators Arithmetic, Relational, NOT, AND, OR Effect of parenthesis Implied conditions

IF TERM > 6 and TERM < 12 THEN IF TERM > 6 AND < 12 THEN 7 Figure 8.5 NO FALSE Compound Conditions A>B? NO YES C>D? FALSE (a) A > B AND C > D NO YES TRUE NO

FALSE C>D? A>B? YES YES FALSE TRUE (b) A > B OR C > D 8 Nested IF statements ELSE clause Comparing a Date to Todays date 9 Figure 8.6 Nested IF Statements NO NO

MOVE B TO BIG C>B? A>B? YES YES NO MOVE C TO BIG MOVE C TO BIG A>C? YES MOVE A TO BIG (a) Flowchart 10 Figure 8.6

Nested IF Statements IF A > B IF A > C MOVE A TO BIG ELSE MOVE C TO BIG END-IF ELSE IF C > B MOVE C TO BIG ELSE MOVE B TO BIG END-IF END-IF. (b) COBOL Statements 11 Figure 8.8 The ACCEPT Statement WORKING-STORAGE SECTION. 01 EMPLOYEE-RECORD. . . 05 EMP-DATE-OF-BIRTH. 10 EMP-BIRTH-MONTH 10 EMP-BIRTH-YEAR

PIC 99. PIC 99. 01 EMPLOYEE-AGE PIC 99V99. 01 DATE-WORK-AREA. 05 TODAYS-YEAR PIC 99. 05 TODAYS-MONTH PIC 99. 05 TODAYS-DAY PIC 99. . . PROCEDURE DIVISION. . . ACCEPT DATE-WORK-AREA FROM DATE. . . COMPUTE EMPLOYEE-AGE = TODAYS-YEAR - EMP-BIRTH-YEAR + (TODAYS-MONTH - EMP-BIRTH-MONTH) / 12. 12 Figure 8.10 (continued) ERROR REPORT AS OF 07/03/98

CONTRACT # LAST NAME ERROR MESSAGE & FIELD CONTENTS 123459 123459 BAKER BAKER INVALID DAY INSURANCE CODE MUST BE Y OR N X 04/31 987651 BROWN MILES DRIVEN UNREASONABLY LOW DAYS: 10 MILES: 000010 999999 999999 999999 JONES JONES JONES

MONTH MUST BE BETWEEN 1 AND 12 MILEAGE IN LESS THAN MILEAGE OUT NON-NUMERIC MILEAGE RATE 13 IN: 004500 OUT: 004600 O5 987655 987655 987655 BROWNING BROWNING BROWNING CAR TYPE MUST BE: E, C, M, F, OR L DATE HAS NOT YET OCCURRED 10/24/98 NON-NUMERIC MILES IN OO2400 0 655443 655443 FITZPATRICK FITZPATRICK INVALID DAY

INSURANCE CODE MUST BE Y OR N C 05/32 PINNOCK PINNOCK PINNOCK PINNOCK PINNOCK NON-NUMERIC CONTRACT NUMBER MISSING FIRST NAME NON ALPHABETIC INITIAL DATE YAS NOT YET OCCURRED 10/12/98 NON-NUMERIC MILES OUT BUTLER BUTLER BUTLER BUTLER NON-NUMERIC CONTRACT NUMBER X93477 INVALID DAY DAYS RENTED MUST BE > ZERO 00 MILEAGE RATE OUT OF RANGE X93477 X93477 X93477 X93477

84644O 84644O 84644O 84644O 84644O NON-NUMERIC CONTRACT NUMBER 84644O MISSING LAST NAME CAR TYPE MUST BE: E, C, M, F, OR L DAYS RENTED MUST BE NUMERIC I5 MILES DRIVEN UNREASONABLY LOW (b) Error Report 1 OO3310 06/31 75 X DAYS: I5 MILES: 000125 13 A data validation program Specifications Program design Program listing Exception report 14

Recently Viewed Presentations

  • Entering the Age of Talentism 45th Annual Forum on Moving

    Entering the Age of Talentism 45th Annual Forum on Moving

    Entering the Age of Talentism 45th Annual Forum Stephen Cryne President & CEO CERC * * Spouse's play a key role in decision making. They may feel they are losing career development opportunities and/or network connections.
  • UDS HTN Measure - Resource Hub

    UDS HTN Measure - Resource Hub

    Hypertension Clinical Quality. Blood pressure control defined by UDS as BP <140/90 in patients diagnosed with hypertension who are 18-85 years old. Exclusions: pregnancy, end-stage renal disease, dialysis. In 2016, 22% of patients cared for at Salud Family Health Centers...
  • TC 1700 KSR Examples

    TC 1700 KSR Examples

    John Deere Co. test (slide 4). See MPEP 2141 for a detailed explanation. A. Combining prior art elements according to known methods to yield predictable results. These are merely examples and do not limit the rationales that may be used....
  • Title of slide

    Title of slide

    Output = simulated raw data → input to reconstruction software: track finding, fitting, etc. Predict what you should see at 'detector level' given a certain hypothesis for 'generator level'. Compare with the real data. Estimate 'efficiencies' = #events found /...
  • A Statistical Investigation of GRB Afterglows

    A Statistical Investigation of GRB Afterglows

    Times New Roman Arial Symbol Times Helvetica Default Design A Statistical Investigation of GRB X-ray and Optical Afterglows Comparison of the Average Optical/UV light curve with XRT canonical model Optical to X-ray Comparison PowerPoint Presentation Mean Properties: RMS Deviation Distribution...
  • Vocabulary Week 15 - TIRE DEALERS

    Vocabulary Week 15 - TIRE DEALERS

    synonyms: dream, hope for. antonym: settle for. Now please write a sentence with context clues and where the vocabulary word is used correctly. Vocabulary Word of the DayTuesday, December 19th. transmute. Alchemy is a medieval science that claims it is...
  • Rapid Construction of Bridges In Seismic Regions

    Rapid Construction of Bridges In Seismic Regions

    A concrete reaction collar block and a 300-kip hydraulic center hole ram was used to pull on the #18 bars. From these tests we learned that: * These tests confirmed that: * This is a plot of embedment length normalized...
  • CS 791Y Special Topics: Scientific Visualization

    CS 791Y Special Topics: Scientific Visualization

    From the American Heritage Dictionary. vir·tu·al (vûrch-l) ADJECTIVE:Existing or resulting in essence or effect though not in actual fact, form, or name: the virtual extinction of the buffalo.. Existing in the mind, especially as a product of the imagination. Used...