Difference between revisions of "Information Systems:Check-digit Validation"

From uniWIKI
Jump to navigation Jump to search
(Created page with "This a way to detect keying errors, and transposed digits. A mathematical calculation is done on the number, and if the result is not the expected value, the number is not va...")
 
m
 
(4 intermediate revisions by the same user not shown)
Line 54: Line 54:
   
 
We can use this check digit validation when bar codes are added to an item, to make sure they are entered correctly.
 
We can use this check digit validation when bar codes are added to an item, to make sure they are entered correctly.
  +
  +
[[Category: Barcodes and Labels]]

Latest revision as of 11:03, 25 August 2016

This a way to detect keying errors, and transposed digits. A mathematical calculation is done on the number, and if the result is not the expected value, the number is not valid. We use this on our item number, and manufactures use it on their UPC and EAN numbers.

UWD Item Numbers

When a new item is created, program DMRUT1 is called to generate the item number. It gets the next available seven digit number from the ASW number series table.

*VA/480B*  Number series table maintenance           1/15/15 15:04:27 GDMD1023 
-------------------------------------------------------------------------------
Series.............. 950                                                       
Description......... Generated Item Number                                     
                                                                               
Last number used....  246919                                                   
First number to use.  200001                                                   
Last number to use.. 9999999                                                   

Then it calculates and appends the check digit. The routine used is ‘double add double’, ‘digit add’.

 0     2     4     6     9     2     0     ?	
 2     1     2     1     2     1     2     1     multiply by weights
--    --    --    --    --    --    --    --
 0     2     8     6    18     2     0     ?

0 + 2 + 8 + 6 + 1 + 8 + 2 + 0 = 27               as this is ‘digit add’ 18 becomes 1 + 8.

The weight of the check digit itself is always one.

The value of the check digit (? In the table above) is the value required to increase the result (27) to a value ending with zero (mod 10) – in this case three.

What this routine actually means is that chances are slim that someone can make a mistake keying in an item number, and come up with a different, valid, number. If a single digit is incorrect, the check digit will not be valid; therefore the number will not match an existing item. At least two digits would have to be incorrect; with a one in ten chance that the second incorrect number will make the check digit correct. Because of the alternating (1 2 1 2) weights the digits are multiplied by, transposing two digits would make an invalid number.

Manufacturer Bar Codes (UPC, EAN)

Manufacturer do the same thing a uniPHARM does, except ‘triple add triple’, ‘product add’.

 0   6   5   6   5   6   0   4   3   7   9   5
 3   1   3   1   3   1   3   1   3   1   3   1
--  --  --  --  --  --  --  --  --  --  --  --
 0   6  15   6  15   6   0   4   9   7  27   5
 
 0 + 6 + 15 + 6 + 15 + 6 + 0 + 4 + 9 + 7 + 27 + 5 = 100     as this is 'product add', 15 
                                                            is NOT split into 1 + 5

The weight of the check digit itself is always one.

As 100 ends in zero, this is a valid UPC.

Some codes are printed as, for example, (01)00609038000244. All the digits will scan, but the ones in brackets are not included in the check digit calculation. This is a code 128 bar code - the (01) indicates that the following number is a product code. Our guns are not returning the brackets.

 0   0   6   0   9   0   3   8   0   0   0   2   4   4	          
 3   1   3   1   3   1   3   1   3   1   3   1   3   1
--  --  --  --  --  --  --  --  --  --  --  --  --  --
 0   0  18   0  27   0   9   8   0   0   0   2  12   4	
 
0 + 0 + 18 + 0 + 27 + 0 + 9 + 8 + 0 + 0 + 0 + 2 + 12 + 4 = 80

We can use this check digit validation when bar codes are added to an item, to make sure they are entered correctly.