 Data Communication Solutions (DCS) recently assisted a U.S. pet toy manufacturer as they upgraded their ERP system. Our work was to identify what in the new output didn’t match their old output and identify what that value difference represented. Over the course of this project, an issue came up regarding UCC-128 barcode labels. In this article, we will first explain how the UCC-128 works. We will then go over the issue our client was having and the solution we provided for them.

#### The UCC-128 Explained

The UCC-128 barcode label is typically a 20-digit number. Its purpose is to uniquely identify each box shipped. This gives the receiving party a quick way to see if something was missed.

The first 19 digits drive a checksum digit in the 20th digit. If the label has been smudged or cut off, this allows someone to tell what the potential missing number was.

Here is an example number: 5479821272156620578x. Notice that the first 19 digits are present and the 20th is missing. How can we find the 20th digit?

First, multiply the odd digits of the first 19 by 3:

5 x 3=15                                                  1 x 3=3
7 x 3=21                                                  6 x 3=18
8 x 3=24                                                  2 x 3=6
1 x 3=3                                                    5 x 3=15
7 x 3=21                                                  8 x 3=24

Second, multiply the even digits of the first 19 by 1:

4 x 1=4                                                    5 x 1=5
9 x 1=9                                                    6 x 1=6
2 x 1=2                                                    0 x 1=0
2 x 1=2                                                    7 x 1=7
2 x 1=2

Third, add the 19 individual products together:

0 + 15=15                                                103 + 3=106
15 + 4=19                                                106 + 5=111
19 + 21=40                                              111 + 18=129
40 + 9=49                                                129 + 6=135
49 + 24=73                                              135 + 6=141
73 + 2=75                                                141 + 0=141
75 + 3=78                                                141 + 15=156
78 + 2=80                                                156 + 7=163
80 + 21=101                                            163 + 24=187
101 + 2=103

The fourth and final step is to calculate the difference between the sum and the next higher multiple of 10. Because our sum is 187, the next higher multiple is 190. 190 – 187 = 3, which is our check digit. This means that our UCC-128 number is 54798212721566205783.

#### DCS’ Work

How does the UCC-128 apply to the EDI solution we provided to our client? Following a system change, the client’s new system only allowed for 10 characters for the shipping package number. Therefore, our client stored the last 10 characters. Because the client needed the barcode to be 20 digits, they padded the rest with a hard-coded number:

01234567890000000001                          01234567890000000006
01234567890000000002                          01234567890000000007
01234567890000000003                          01234567890000000008
01234567890000000004                          01234567890000000009
01234567890000000005                          01234567890000000010

The real UCC-128 went out on the labels. Meanwhile, the made-up numbers went onto the data. When our client’s trading partners received the packages, nothing matched and all shipments were being refused, stating that the barcode numbers on the labels were wrong.

DCS EDI Specialist Rob Hollis wrote the code to validate if the barcode was correct. This code allowed the client to  determine which one was incorrect (physical or data) and trace the data back to its author. Through discussion with the client, Rob found out what assumptions they had made and provided guidance regarding the actual process. Thanks to our help, the client learned that they should have expanded the shipping package field size to allow for the full number instead of trying to save space in order to save coding time.