Click here to Skip to main content
15,879,095 members
Articles / Programming Languages / Visual Basic
Article

USPS OneCode Barcodes

Rate me:
Please Sign up or sign in to vote.
4.83/5 (20 votes)
3 Oct 2008Apache2 min read 158.3K   3.6K   54   46
USPS One Code - Intelligent Mail Barcode (4-State Customer Barcode) - implementation with VB 2008

Introduction

This is not a typical article. The focus is on Intelligent Mail Barcode (4 State Customer Barcode) or USPS OneCode implementation as a direct solution for anyone who needs it. The downloads include one VB.NET and one C# class – VS2008 with .NET 3.5 syntax - that generate the string expression of OneCode barcodes and decode a barcode string. The code (uncommented) is a modified fraction of the Pathenon project (covers all known 1D and 2D barcodes) that you will read here on The Code Project in the near future, hopefully. I've noticed that there is no related article, so there you are with an ASAP solution for this new USPS symbology.

Basic Information

Intelligent Mail Barcode, also known as the USPS OneCode Solution or USPS 4-State Customer Barcode (abbreviated 4CB, 4-CB, or USPS4CB), is the latest barcode symbology of the United States Postal Services. It combines routing ZIP code information and tracking information into a single 4-state code. It effectively encodes data from POSTNET and PLANET barcodes into a single barcode while providing a greater range of tracking data.

A 4-state barcode is based on a tracker with ascenders and descenders. The four possible states are tracker (neither ascender nor descender), full (both ascender and descender), ascender only, and descender only. The Intelligent Mail barcode consists of 65 bars as a result of encoding data fields of the following types:

Tracking Code

  • Barcode Identifier as 2 digits (2nd digit must be 0–4)
  • Service Type Identifier as 3 digits
  • Mailer Identifier as 6 or 9 digits and
  • Serial Number as 9 (when used with 6 digit Mailer ID) or 6 (when used with 9 digit Mailer ID) digits

Routing Code

  • Delivery Point ZIP Code as 0, 5, 9, or 11 digits

The above fields, with a maximum of 31 digits in length, are encoded via a complex process (involving big integers and transposed lookups) to bars expressed as a string with 65 characters in the range of A, D, T, F. More information and specifications can be found here.

Conclusion

Note once again that this is not a typical article, but a direct solution for people dealing with this complex barcode symbology.

Thanks for your time.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0



Comments and Discussions

 
QuestionCode not always working. Pin
Swiler Delp10-Jan-23 7:23
Swiler Delp10-Jan-23 7:23 
AnswerRe: Code not always working. Pin
Swiler Delp10-Jan-23 7:46
Swiler Delp10-Jan-23 7:46 
GeneralRe: Code not always working. Pin
mani2k514-Mar-23 3:58
mani2k514-Mar-23 3:58 
QuestionAdded the fixes mentioned in the comments to C# code Pin
Deepfreezed31-Jul-13 4:55
Deepfreezed31-Jul-13 4:55 
QuestionMessage Closed Pin
15-Feb-12 22:32
steve7g15-Feb-12 22:32 
AnswerRe: transportation barcode Pin
sybil_9-Oct-12 16:53
sybil_9-Oct-12 16:53 
GeneralMy vote of 4 Pin
the headless nick2-Aug-11 0:52
professionalthe headless nick2-Aug-11 0:52 
GeneralDecoder in plan C Pin
Member 420048219-Sep-10 15:22
Member 420048219-Sep-10 15:22 
AnswerRe: Decoder in plan C Pin
the retired19-Sep-10 21:57
the retired19-Sep-10 21:57 
GeneralBarcode Pin
Jones xxx26-May-09 13:19
Jones xxx26-May-09 13:19 
Generalhelp pls.... Pin
lakshmi priya.t.n29-Jan-09 17:41
lakshmi priya.t.n29-Jan-09 17:41 
AnswerRe: help pls.... Pin
the retired31-Jan-09 11:47
the retired31-Jan-09 11:47 
GeneralCompilation error Pin
robertjb207-Jan-09 9:45
professionalrobertjb207-Jan-09 9:45 
AnswerRe: Compilation error Pin
the retired8-Jan-09 5:14
the retired8-Jan-09 5:14 
GeneralHere is another Implementation for .Net (C#) using USPS provided dll and fonts Pin
Member 422991713-Nov-08 8:43
Member 422991713-Nov-08 8:43 
QuestionSample application Pin
amarbank23-Nov-10 6:38
amarbank23-Nov-10 6:38 
GeneralRe: Here is another Implementation for .Net (C#) using USPS provided dll and fonts Pin
crobbins6-Jan-11 8:56
crobbins6-Jan-11 8:56 
GeneralRe: Here is another Implementation for .Net (C#) using USPS provided dll and fonts Pin
sjtorres15-Jun-11 8:12
sjtorres15-Jun-11 8:12 
QuestionRe: Here is another Implementation for .Net (C#) using USPS provided dll and fonts Pin
bendece25-Feb-11 16:09
bendece25-Feb-11 16:09 
QuestionIncorrect Decode Example Pin
voxdisc10-Nov-08 16:35
voxdisc10-Nov-08 16:35 
AnswerRe: Incorrect Decode Example Pin
bheiland22-May-09 2:15
bheiland22-May-09 2:15 
GeneralRe: Incorrect Decode Example Pin
Gylfi Ingvason27-May-09 8:59
Gylfi Ingvason27-May-09 8:59 
GeneralRe: Incorrect Decode Example Pin
bheiland27-May-09 13:59
bheiland27-May-09 13:59 
AnswerRe: Incorrect Decode Example Pin
bheiland27-May-09 14:04
bheiland27-May-09 14:04 
GeneralRe: Incorrect Decode Example Pin
bheiland27-May-09 14:23
bheiland27-May-09 14:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.