Calculation of test figures

Started by Petrus Vorster, February 26, 2016, 01:07:49 PM

Previous topic - Next topic

Petrus Vorster

Hi all

I know this is not really applicable to our forum, but i am just taking a chance if someone might have worked with this kind of maths.

We have a system that uses supplier-printed barcodes, which one can easily reproduce using a barcode font like Code39.
The catch is, you can only reproduce an existing barcode as they have added a test figure as the 11th number in a barcode of 13 characters.
Making your own does scan, but the systems rejects it. The test figure is therefore not validated by the scanner like EAN128, but a mere system related math test.

Its been close to 6 months now of reading and surfing the net, and i am not closer to an answer.

Our tracking systems only accepts valid tracking numbers, but the agreement with the suppliers of printed barcodes went sour and nobody spills the beans on how the test figure is calculated. The rest i figured out on day 1, but i am trough nearly an entire exam pad trying to calculate it.

If anyone is up for a math challenge, let me know and i will post a handful of valid numbers to work on.
the idea is to create a local label-printing app that can generate internal barcodes that is validated by our system without the use of expensive packs of pre-printed barcodes.

Will be most happy if someone is up for a challenge.
-Regards
Peter

Chris Maher

Not sure I am up to the maths but I create lots of odd logistics barcodes using PB code and have full verification equipment to ensure they work.

That doesn't solve the mystery digit but often it will be based on common protocols.

I am happy to try a few numbers but I would also like to see a good clean scan of an original set of barcodes so I can look at what they are using to encode it.

No promises but I will give it a try..

Chris.

Petrus Vorster

Thanks Chris!

I have attached some PDF scans and one for explanation.
I really hope you can help me find this test figure.

Thanks a million for trying!
-Regards
Peter

Chris Maher

Hi Petrus,

This calculated "test figure" within a barcode is more normally referred to as a "check digit" in the Auto-ID industry.
As you guessed in your notes, this is a Universal Postal Union (UPU) barcode and it is known as an international S10 13-character postal item identifier.

The good news:
This a link to the full technical specification including a clear check digit calculation explanation in section 5.4.
http://www.upu.int/uploads/tx_sbdownloader/S10TechnicalStandard.pdf

This is a link to a spreadsheet that checks the validity of the check digit.
http://www.upu.int/uploads/tx_sbdownloader/toolStandardsS10CheckDigitValidationToolEn.xls

The bad news:
To ensure the integrity of the international system..
QuoteThe identification requirement is met by the definition and use of a 13-character postal item identifier, according to which a single authority in each UPU member country controls the allocation of unique item identifiers for use with the special categories of postal items concerned.

and
QuoteThe organization assigned by the UPU member country shall manage the issue and use of S10 identifiers, among all the operators under the authority of that UPU member country, in such a way as to ensure that no S10 identifier is reused within a period of 12 calendar months. A period of 24 calendar months, or longer, is recommended.

So the only way you can issue these numbers yourself is to be assigned a range of numbers to use. Otherwise you may/will clash with other users and possibly corrupt the international UPU post/parcel tracking systems.
QuoteOperators may authorise individual customers to control the issue of their own S10 identifiers by allocating them a specific service indicator value and/or serial number range, provided that this is done in a way which ensures that no S10 identifier is reused within a period of 12 calendar months.

I hope that helps your quest or at least resolves the initial test figure query. Let me know if I can help more.

Chris.

Petrus Vorster

Chris, you're the man!!

I was so close, but no cigar!
Next time ill ask here first!!

A million thanks once again!!!

PS, luckily they have given us a range internally per operational area and branch.
That's where my thoughts of generating this started, when i saw that some years ago they had a system that generated barcodes for certain internal tracking items.
They abandoned the function, not realizing that many years later it could be of great importance. This area codes prevented duplication or overlapping with another country or member.

Thank you once again!!
-Regards
Peter

Chris Maher

Hi Petrus,

You are most welcome. I hope it comes together for you now. Just remember to allocate the ranges carefully/automatically and I am sure you will succeed!

This kind of project often fails when humans key in the sequential numbers and/or systems are not centrally controlled and locked down.

Who knows - maybe next you will be importing the tracking/signature data to upload to your customer service systems?

Good luck,

Chris.

Petrus Vorster

 ;D Works like a charm!

Created an excel sheet first with the MOD11 and weighted scores and an IF statement for the correct Weighted Check Digit.
Just checked about 40 valid trackers and if works without fail!!!

Now all i have to do is write the little app, use a barcode font, counter and my region serial, and out on a label printer!!!

Chris, you saved me EONS! Thanks again!!
-Regards
Peter

Petrus Vorster

Thanks to Chris and others for the help, this little module now works perfectly.
It creates the MOD11 weighted check-digits, create a valid region/country-specific barcode serial and doesnt repeat the barcode every 10 000 barcodes.
I still have the output in a code39 font since i still struggle to encode the EAN128 structure, but the check-digit part nearly drove me nuts.
Thanks everyone.
-Regards
Peter