Check Digit - Mod 11 Please use speaker notes for additional information!

Slides:



Advertisements
Similar presentations
Adders Used to perform addition, subtraction, multiplication, and division (sometimes) Half-adder adds rightmost (least significant) bit Full-adder.
Advertisements

Table de multiplication, division, addition et soustraction.
Demonstration Problem
Multiplying Powers Dividing Powers Zero ExponentsNegative.
Math Vocabulary Review Part 1.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 5: Repetition and Loop Statements Problem Solving & Program.
Jeopardy ExponentsOrder of Operations Mult/Div Fractions Converting Fractions Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Final.
L.O.1 To be able to recall multiplication and division facts involving the 2,3,4,6,7 and 8 times tables.
C1 Sequences and series. Write down the first 4 terms of the sequence u n+1 =u n +6, u 1 =6 6, 12, 18, 24.
DT266/2 Information Systems COBOL Revision. Chapters 1 & 2 Hutty & Spence Divisions of a Cobol Program Identification Division Program-ID. Environment.
Order of Operations PEMDAS.
Parentheses- (), {}, [] Exponent- 2³ Multiply or Divide- which ever come first Add or subtract- which ever comes first.
$100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400.
Columbus State Community College
DIVISIBILITY, FACTORS & MULTIPLES
Tables1 TABLES (chp. 12) group of storage locations (i.e. elements) with the same name accessed by name and subscript ex. var-name (sub) similar to arrays.
Using the TI 83 Plus Calculator
DT266/2 COBOL Basics – Declaring Data Basic Operations.
Presented by: Tutorial Services The Math Center
Section 3.2: Using Check Digits
Benchmark Series Microsoft Excel 2013 Level 2
 Copyright I/O International, 2013 Visit us at: A Feature Within from Item Class User Friendly Maintenance  Copyright.
Created by Susan Neal $100 Fractions Addition Fractions Subtraction Fractions Multiplication Fractions Division General $200 $300 $400 $500 $100 $200.
SYSTEMS OF EQUATIONS.
Fraction XI Adding Mixed Numbers With Unlike Denominators
8 2.
Lob: I can use pencil and paper methods to divide TU by U and HTU by U.
The simplex algorithm The simplex algorithm is the classical method for solving linear programs. Its running time is not polynomial in the worst case.
1 How Do I Order From.decimal? Rev 05/04/09 This instructional training document may be updated at anytime. Please visit and check the.
23-8 3x6 Double it Take Away 6 Share By 9 Double it +10 Halve it Beginner Start Answer Intermediate 70 50% of this ÷7÷7 x8 Double it Start Answer.
Jeopardy DivisibilityARRAYS Prime or Composite All things SQUARE Remember ? Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Final.
1 BRState Software Demonstration. 2 After you click on the LDEQ link to download the BRState Software you will get this message.
6.1 Factoring Polynomials
Hosted by Lynn Dickson Choice1Choice 2Choice 3Choice
Factors Terminology: 3  4 =12
2 x0 0 12/13/2014 Know Your Facts!. 2 x1 2 12/13/2014 Know Your Facts!
2 x /18/2014 Know Your Facts!. 11 x /18/2014 Know Your Facts!
Partial Products. Category 1 1 x 3-digit problems.
Literary Issues Ups and downs Inside and OUT Make sure.
2 x /10/2015 Know Your Facts!. 8 x /10/2015 Know Your Facts!
Playing computer with logic problems Please use speaker notes for additional information!
Year 3 Objectives: Number NUMBER AND PLACE VALUE Objective 1: Read and write numbers up to 1000 in numerals and words Read and write all numbers to 100.
5 x4. 10 x2 9 x3 10 x9 10 x4 10 x8 9 x2 9 x4.
EMIS 8374 LP Review: The Ratio Test. 1 Main Steps of the Simplex Method 1.Put the problem in row-0 form. 2.Construct the simplex tableau. 3.Obtain an.
Multiplication Facts Practice
Graeme Henchel Multiples Graeme Henchel
1.Print and cut round outside of cootie catcher 2.Fold in half and in half again 3.Open out, turn over so.
0 x x2 0 0 x1 0 0 x3 0 1 x7 7 2 x0 0 9 x0 0.
Adding & Subtracting Mixed Numbers. Objective: To develop fluency in +, –, x, and ÷ of non-negative rational numbers. Essential Question: How.
Count to 20. Count reliably at least 10 objects. Use ‘more’ and ‘less’ to compare two numbers. Count reliably at least 10 objects. Estimate number of objects.
7x7=.
MATLAB Examples. CS 1112 MATLAB Examples Find the number of positive numbers in a vector x = input( 'Enter a vector: ' ); count = 0; for ii = 1:length(x),
Modifications to program Addda.cbl Please use speaker notes for additional information!
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
Totals on the Screen Please use speaker notes for additional information!
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
Array - adding to array at run time Please see speaker notes for additional information!
Divisibility Test For Different Numbers
Explanation of SAMPLEIF (if88in1.cbl or if88in1.html) Please use speaker notes for additional information!
COBOL Screens Please use speaker notes for additional information!
Positive and Negative numbers. Negative numbers A positive or negative whole number, including zero, is called an integer. For example, –3 is an integer.
Verification & Validation. Batch processing In a batch processing system, documents such as sales orders are collected into batches of typically 50 documents.
My Book of Divisibility. THE 2’s Example: 30, 42, 24, 76, 98, Must be an even number Number must end in a 0, 2, 4, 6, or 8.
General Introduction Algorithms. Let’s write a program  A program is a collection of statements written in a language the computer understands.  A computer.
Subroutines (PrArith, Math,projCP1, PrAdrProc, PrAdrProcFunc) Please use speaker notes for additional information!
Knowing your math operation terms
Minor, Intermediate and Major Breaks
Using screens and adding two numbers - addda.cbl
Date Conversion Program
Presentation transcript:

Check Digit - Mod 11 Please use speaker notes for additional information!

Find the check digit for : Mod digits x8 x7 x6 x5 x4 x3 x2 multiply by weight = remainder 2 11) = 9 Number with check digit

Validate the check digit for : Mod digits x8 x7 x6 x5 x4 x3 x2 x1 multiply by weight = )121 Remainder is 0 When the remainder is 0, we know the number with the check digit is valid! Number with check digit

IDENTIFICATION DIVISION. PROGRAM-ID. MOD11CHK. AUTHOR. GROCER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. WORKING-STORAGE SECTION. 01 ID-NUM. 05 DGT PIC 9 OCCURS 7 TIMES. 05 CHK-DGT PIC RDF-CHK-DGT REDEFINES CHK-DGT PIC X. 01 RDF-ID-NUM REDEFINES ID-NUM PIC X(8). 01 SUBSCRIPTZ. 05 SUB-DGT PIC 9 VALUE RESPONSEZ. 05 MENU-ANS PIC X VALUE SPACES. 05 RESPNSE PIC X VALUE SPACES. 05 MSG PIC X(29) VALUE SPACES. 01 WORK-ANS. 05 WT PIC 9 VALUE MULT-ANS PIC 99 VALUE SUM-DGTS PIC 999 VALUE DIVIDE-ANS PIC 99 VALUE REM-ANS PIC 99 VALUE SUBT-ANS PIC 99 VALUE 0. Mod 11 CHK-DGT must be redefined as a character field to accommodate the X that might be there. I have defined the number in WS as having 7 digits. I have then added the 8th digit which is the check digit and redefined it. I have then redefined the whole so I can move the entire number with the check digit even if the check digit is X. These are the work areas that I have set up to do the calculation. Note that WT which stands for weight starts with an initial value of 8. This will need to be reset if I am calculated multiple check digits.

SCREEN SECTION. 01 MENU-SCR. 05 VALUE "MENU" BLANK SCREEN LINE 5 COL VALUE "1 - CALCULATE CHECK DIGIT" LINE 8 COL VALUE "2 - VALIDATE CHECK DIGIT" LINE 9 COL VALUE "3 - END PROCESSING" LINE 11 COL VALUE "ENTER SELECTION" LINE 13 COL TAKE-IN-MENU-ANS LINE 13 COL 36 PIC X TO MENU-ANS. 01 TAKE-IN-ID-SCR. 05 VALUE "PLEASE ENTER NEW ID" BLANK SCREEN LINE 5 COL ID-INPUT LINE 5 COL 30 PIC 9(7) TO ID-NUM. 05 "PRESS ANY KEY TO CONTINUE..." LINE 10 COL TAKE-IN-FIRST-ANS LINE 10 COL 40 PIC X TO RESPNSE. 01 TAKE-IN-WHOLE-SCR. 05 VALUE "PLEASE ENTER ID TO VALIDATE" BLANK SCREEN LINE 5 COL WHOLE-INPUT LINE 5 COL 40 PIC X(8) TO RDF-ID-NUM. 05 "PRESS ANY KEY TO CONTINUE..." LINE 10 COL TAKE-IN-SECOND-ANS LINE 10 COL 40 PIC X TO RESPNSE. Mod11 Menu screen to choose to calculate the check digit or validate the check digit. If the user choose to calculate a check digit, then they will enter the 7 digit number here. If the user choose to validate a check digit, then they will enter the 8 digit number here.

01 SHOW-RESULT-SCR. 05 VALUE "THE ID WITH CHECK DIGIT IS" BLANK SCREEN LINE 5 COL COMPLETED-ID LINE 5 COL 40 PIC X(8) FROM ID-NUM. 05 MSG-AREA LINE 7 COL 20 PIC X(30) FROM MSG. 05 VALUE "PRESS ANY KEY TO CONTINUE..." LINE 10 COL TAKE-IN-THIRD-ANS LINE 10 COL 40 PIC X TO RESPNSE. Mod 11 The results of calculating the check digit are displayed here along with the check digit.

PROCEDURE DIVISION. MAINLINE. PERFORM B-100-PROCESS. STOP RUN. B-100-PROCESS. DISPLAY MENU-SCR. ACCEPT MENU-SCR. PERFORM B-200-LOOP UNTIL MENU-ANS = "3". B-200-LOOP. IF MENU-ANS = "1" PERFORM B-300-CALC ELSE IF MENU-ANS = "2" PERFORM B-310-VALIDATE. DISPLAY MENU-SCR. ACCEPT MENU-SCR. Mod11 Initial take-in of the choice to calculate or verify from the menu. Checking of the menu to determine processing. Display and accept to take in menu choices after the initializing choice.

B-300-CALC. MOVE SPACES TO RDF-ID-NUM. MOVE SPACES TO MSG. DISPLAY TAKE-IN-ID-SCR. ACCEPT TAKE-IN-ID-SCR. MOVE 8 TO WT. MOVE 1 TO SUB-DGT. MOVE 0 TO SUM-DGTS. PERFORM B-400-MULT-ROUT 7 TIMES. DIVIDE SUM-DGTS BY 11 GIVING DIVIDE-ANS REMAINDER REM-ANS. SUBTRACT REM-ANS FROM 11 GIVING SUBT-ANS. IF SUBT-ANS = 10 MOVE "X" TO RDF-CHK-DGT ELSE IF SUBT-ANS = 11 MOVE 0 TO CHK-DGT ELSE MOVE SUBT-ANS TO CHK-DGT. DISPLAY SHOW-RESULT-SCR. ACCEPT SHOW-RESULT-SCR. Mod11 Take in screen to take in the identification number. Initialize weight at 8 since there will be 8 digits (currently there are 7), SUB-DGT (the pointer) to 1 and zero out the sum in SUM-DIGITS. Perform the routine to do the weight multiplication and accumulate the sum 7 times since there are 7 digits. Do the remaining math work of dividing to get the remainder and subtracting the remainder to get the answer. If the answer is 10 move X to the check digit, if 11 move 0 to the check digit, otherwise move the result of the subtraction to the check digit. Display the results of the calculation on the screen.

B-310-VALIDATE. MOVE SPACES TO RDF-ID-NUM. MOVE SPACES TO MSG. DISPLAY TAKE-IN-WHOLE-SCR. ACCEPT TAKE-IN-WHOLE-SCR. MOVE 8 TO WT. MOVE 1 TO SUB-DGT. MOVE 0 TO SUM-DGTS. PERFORM B-400-MULT-ROUT 7 TIMES. IF RDF-CHK-DGT = "X" ADD 10 TO SUM-DGTS ELSE ADD CHK-DGT TO SUM-DGTS. DIVIDE SUM-DGTS BY 11 GIVING DIVIDE-ANS REMAINDER REM-ANS. IF REM-ANS > 0 MOVE "****** ERROR IN ID ******" TO MSG ELSE MOVE "****** VALID ID ******" TO MSG. DISPLAY SHOW-RESULT-SCR. ACCEPT SHOW-RESULT-SCR. Mod 11 Take in screen to take in the whole identification number including the check digit.. Initialize weight at 8 since there are 8 digits, SUB-DGT (the pointer) to 1 and zero out the sum in SUM- DIGITS. Perform the routine to do the weight multiplication and accumulate the sum 7 times since there are 7 digits before the check digit. If the check digit is X, 10 is added to the sum otherwise the value of the check digit is added to the sum. Divide the sum of all 8 digits (including the check digit by 11 and get the remainder. If the remainder is 0 then the check digit is valid. If the remainder is greater than 0 an error message is moved to the screen. If the remainder is 0 a valid message is moved to the screen. The screen is displayed showing the number and a message confirming validity or highlighting an error.

B-400-MULT-ROUT. MULTIPLY DGT (SUB-DGT) BY WT GIVING MULT-ANS. ADD MULT-ANS TO SUM-DGTS. SUBTRACT 1 FROM WT. ADD 1 TO SUB-DGT. Mod 11 This is the routine that multiplies each digit by its weight and as each is multiplied, adds it to the total. It than subtracts 1 from the weight to prepare for the next pass through the routine and increments the subscript by 1 to again prepare for the next pass.