Data validation ? ? ? ?.  Verify data compliance at input (interactive / automated)  logical, arithmetical conditions etc.  Aspects  conditions 

Slides:



Advertisements
Similar presentations
Chapter 4 Computation Bjarne Stroustrup
Advertisements

1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 8- 1 Overview 8.1 An Array Type for Strings 8.2 The Standard string.
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
More on Numerical Computation CS-2301 B-term More on Numerical Computation CS-2301, System Programming for Non-majors (Slides include materials from.
1 CSE1301 Computer Programming: Lecture 9 Input/Output.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 6P. 1Winter Quarter I/O in C Lecture 6.
How to Program in C++ CHAPTER 3: INPUT & OUTPUT INSTRUCTOR: MOHAMMAD MOJADDAM.
Guide To UNIX Using Linux Third Edition
C++ Programming Language Day 1. What this course covers Day 1 – Structure of C++ program – Basic data types – Standard input, output streams – Selection.
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Input/Output  Input/Output operations are performed using input/output functions  Common input/output functions are provided as part of C’s standard.
Advanced Shell Programming. 2 Objectives Use techniques to ensure a script is employing the correct shell Set the default shell Configure Bash login and.
OCAN College Access Program Data Submissions Vonetta Woods HEI Analyst, Ohio Board of Regents
CNG 140 C Programming (Lecture set 9) Spring Chapter 9 Character Strings.
1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
COMP 116: Introduction to Scientific Programming Lecture 28: Data types.
Sales person receive RM200/week plus 9% of their gross sales for that week. Write an algorithms to calculate the sales person’s earning from the input.
The Java Programming Language
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Outline Character Strings Variables and Assignment Primitive Data Types Expressions Data Conversion Interactive Programs Graphics Applets Drawing Shapes.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Data Types and Operations On Data Objective To understand what data types are The need to study data types To differentiate between primitive types and.
QA and Testing. QA Activity Processes monitoring Standards compliance monitoring Software testing Infrastructure testing Documentation testing Usability.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
Basics and arrays Operators:  Arithmetic: +, -, *, /, %  Relational:, >=, ==, !=  Logical: &&, ||, ! Primitive data types Byte(8), short(16), int(32),
Verification & Validation. Batch processing In a batch processing system, documents such as sales orders are collected into batches of typically 50 documents.
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
Basic I/O in C Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens Stream Model of I/O header file: A stream provides a connection.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
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?
Matlab Data types, input and output. Data types Char: >> a = ‘ Jim ’ Char: >> a = ‘ Jim ’ Numeric: uint8, uint16, uint32, uint64 int8, int16, int32, int64.
Working with sequential files ? ? ? ?.  Data representation ▪ text ▪ binary (data files)  Records with the same/different structure (size) ▪ Same structure.
CMPSC 121- Spring 2015 Lecture 6 January 23, 2015.
Introduction ABAP Fields and Variables. Slide 2 Fields (Introduction) In ABAP, fields (or data objects) are named locations in memory Variables store.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
An Introduction to Regular Expressions Specifying a Pattern that a String must meet.
CS 1704 Introduction to Data Structures and Software Engineering.
A.Abhari CPS1251 Topic 2: C Overview C Language Elements Variable Declaration and Data Types Statement Execution C Program Layout Formatting Output Interactive.
Files A collection of related data treated as a unit. Two types Text
CCSA 221 Programming in C INPUT AND OUTPUT OPERATIONS IN C – PART 1 1.
BIL 104E Introduction to Scientific and Engineering Computing Lecture 2.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Chapter 3: Input/Output. Objectives In this chapter, you will: – Learn what a stream is and examine input and output streams – Explore how to read data.
Chapter # 2 Part 2 Programs And data
Basic concepts of C++ Presented by Prof. Satyajit De
Introduction to C++ (Extensions to C)
Chapter 7 Text Input/Output Objectives
Chapter 7 Text Input/Output Objectives
Variables, Expressions, and IO
File Input/Output.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 2 Applications and Data.
Input/Output Input/Output operations are performed using input/output functions Common input/output functions are provided as part of C’s standard input/output.
CSI 121 Structured Programming Language Lecture 7: Input/Output
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Topics Introduction to File Input and Output
Introduction to C++ Programming
An Introduction to Java – Part I, language basics
Beginning C Lecture 11 Lecturer: Dr. Zhao Qinpei
CS 100: Roadmap to Computing
Chapter 2: Java Fundamentals
Chapter 3: Input/Output
Chapter # 2 Part 2 Programs And data
Buffer Overflows.
CSE 1020:Software Development
Topics Introduction to File Input and Output
DATA TYPES There are four basic data types associated with variables:
Presentation transcript:

Data validation ? ? ? ?

 Verify data compliance at input (interactive / automated)  logical, arithmetical conditions etc.  Aspects  conditions  actions (correct / incorrect): read again / abandon etc.  signal errors (short, clear messages)  error correction methods  Error sources  key-pressing errors => read again immediately  errors in source documents => temporary abandon, analysis, repeat later  wrong data format in automated sources => abandon, analysis, trylater

Data validation. Levels, types  Validation levels  field – compliance to preset conditions  record – correlation with other fields etc.  group of records – correlations, completeness, totals etc.  file – correlations, completeness, totals etc.  Validation types at field level  existence  nature  length  sign etc.

Data Validation. Actions  Field level (input from keyboard)  if wrong: input again ▪ until correct or ▪ predefined max. no. of retries then abandon – default value?  if correct: go to next field  Record level  if wrong: abandon the record – other actions?  if correct: save the record and start reading next one

Data validation. Principle schema Message, if input from keyboard Dacă e citire de la tastatură screen / log file er = 2 er = n er > 0 nr. = 0 nr. ++ er > 0 && nr < max

Data validation. Methods  Universal method  Read as string, followed by verification / conversion  Language and validation type specific methods  Verification during reading (depends on implementation) ▪ using error code / return value of read functions ▪ using specific error variables  How to choose a method 1. validation type 2. language facilities 3. ease of implementation

Data validation. Nature validation  Nature  numerical 0-9. – (may allow spaces at begin / end)  alphabetical a-z A-Z space others (subsets)  alphanumerical usually no validation  Numerical nature validation  direct (while reading) – depends on language facilities  string, [verify each character], conversion

Data validation. Numerical nature validation //dată întreagă, cu semn – citire ca șir de caractere er = 1; while( er ) { //preluarea valoare ca sir gets_s( s ); //validare er = 0; n = strlen( s ); if( (s[0]!='+') && (s[0]!='-') && ((s[0] '9')) ) er = 1; for( i=1; i<n; i++) if( (s[i] '9') ) er = 1; //conversie if(!er) x = atoi( s ); } //I: mesaj intrare, mesaj eroare //E: valoare numerica intreaga validata int citeste_numar_intreg(char* mesaj, char* eroare) { int er,n,i,x; char s[20]; printf_s("\n"); printf_s(mesaj); else { printf_s(eroare); printf_s("\n"); } return x; } int a; a=citeste_numar_intreg("Temperatura: ", "Valoare incorecta. Mai incearca o data!"); Temperatura: qwr Valoare incorecta. Mai incearca o data. Temperatura: Valoare incorecta. Mai incearca o data. Temperatura: 132qwr Valoare incorecta. Mai incearca o data. Temperatura: asf123 Valoare incorecta. Mai incearca o data. Temperatura: 1asd321 Valoare incorecta. Mai incearca o data. Temperatura: -asd Valoare incorecta. Mai incearca o data. Temperatura: -13+ Valoare incorecta. Mai incearca o data. Temperatura: 23

Data validation. Numerical nature validation //integer data – validation by reading er = 1; while( er ) { fflush( stdin ); if( scanf_s("%d", &x) == 1 ) er = 0; } Valoare = qqawdfa valoare incorecta. Mai incearca o data. Valoare = as1243 valoare incorecta. Mai incearca o data. Valoare = 324sag

Data validation. Length, domain validation  Length  existence (non-zero length)  Specified length (exact, max, min)  Domain / set of values  Domain / predefined set of values, depends on type ▪ string: predefined list of strings ▪ numerical: predefined list of values, intervals ▪ characters: predefined list of values, intervals

Spor la înv ă ţat!