Dec 232017
Program to print Postal barcodes on envelopes. Also includes an excellent description of how the barcodes are generated.
File POSTNT.ZIP from The Programmer’s Corner in
Category Printer Utilities
Program to print Postal barcodes on envelopes. Also includes an excellent description of how the barcodes are generated.
File Name File Size Zip Size Zip Type
POSTNT.DOC 6691 2387 deflated
POSTNT.EXE 8784 5121 deflated
POSTNT.PAS 8144 1790 deflated
ZIP_DEM1.PAS 8141 1783 deflated

Download File POSTNT.ZIP Here

Contents of the POSTNT.DOC file

POSTNT.EXE 02-25-90
A Brief(?) Explanation

Some years ago the US Postal Service began a program to automate the
handling of the mail. Part of this program involves optical character
readers which attempt to read the address on a letter and then spray
a barcode (using an ink-jet printer) on the letter. The barcode
represents the ZIP+4 for that address. Barcoded letters are in turn
sorted by barcode sorting equipment.

This barcode is called a POSTNET code. POSTNET is an acronym for
POSTal Numeric Encoding Technique. POSTNET is essentially a binary
code used to represent numbers. POSTNET differs from other commonly
used barcodes such as 2 of 5, code 39 , or UPC. POSTNET barcodes
consist of a series of tall and short bars, whereas the other barcodes
mentioned are combinations of wide or narrow bars and spaces.

POSTNET uses a series of 5 bars, 2 tall and 3 short, in various combinations
to represent the digits 0 through 9. In decoding a POSTNET barcode the tall
bars are viewed as '1' and the short bars are '0' and the relative position
of the '1' or '0' determines the actual value of the code.
Below is a representation of a POSTNET barcode.


7 4 2 1 0 (position value left to right)

To decode this barcode add the position values under the TALL bars (remember
the short bars have no value). There is a tall bar over the 4 and a tall bar
over the 1, therefore this POSTNET barcode represents a 5.

There is one exception to this rule and that is the barcode for 0 (zero).
Below is a representation of the POSTNET barcode for 0 (zero).


7 4 2 1 0 (position value left to right)

Since each group of 5 bars represents 1 digit and the sum of the position
values in the above barcode is 11, this combination of bars is always
understood to represent the digit 0 (zero).

POSTNET barcodes also include a check digit and leading and trailing tall
bars which are called frame bars. Frame bars merely tell the barcode
reading equipment when the barcode starts and stops. A check digit is used
in case some part of the barcode becomes unreadable (smeared, etc.).
Below is a representation of a POSTNET barcode for St. Paul, MN 55101,
including the leading and trailing frame bar and the check digit.

--------- _________ --------- _________ --------- *********
F 5 5 1 0 1 8* F
r check r
a digit a
m m
e e

This barcode starts with the leading frame bar, then 5 groups of 5 bars each
which represent the digits of the ZIPcode (55101), then the check digit 8 and
finally the trailing frame bar

The check digit is the result of the following calculation:

1) add the digits of the ZIPcode
2) this number is divided by modulo 10
3) the remainder from the previous step is subtracted from ten
4) the result is the check digit.

In the case of the example 55101:

1) 5+5+1+0+1=12
2) 12 MOD 10 = 2
3) 10-2=8
4) the check digit for ZIP 55101 is 8

Why in the world ...???
Using the example above let's see what happens if one of the groups of
bars in a barcode becomes unreadable.

--------- _________ --------- _________ --------- *********
F 5 ? 1 0 1 8* F
r check r
a digit a
m m
e e

The group of bars which represented the second 5 in the barcode has become
unreadable. Can we still use this barcode to determine the ZIPcode?
Yes, and the method uses the check digit. To determine the missing digit
do the following:

1) add the digits of the readable portion of the barcode
2) this sum is divided by modulo 10
3) the remainder is subtracted from 10
4) the result is the missing digit

1) 5+1+0+1+8=15
2) 15 MOD 10 = 5
3) 10-5=5
4) the missing digit is 5

9 digit ZIPcodes (ZIP+4) work exactly the same way except, of course, they
have more bars in the barcode.

There are several other specifications for the POSTNET barcode aside from this
quick(?) explanation. If you wish to have more detailed information have your
local Post Office get you a copy of USPS publication 25. Smaller offices may
not be familiar with this item but you should be able to obtain it through
the Marketing Department or the Automation Readability Specialist in larger

The program

POSTNT was written as an exercise. The intent was to produce a program
which could print US Postal Service POSTNET barcodes that could be used
for demonstration and information purposes. As it turned out, the barcodes
actually are 'readable' on a barcode sorter. The program works with an
'IBM' compatible graphics printer.

To run the program simply type POSTNT and the ZIPcode you want printed as
a barcode.
POSTNT works with 5 digit ZIPs e.g. 55101
9 digit ZIPs (ZIP+4) e.g. 55101-9306 or 551019306

The program also prints "B field" barcodes which are a combination of a
5 digit barcode, a space of about a quarter inch, and then six additional
digits in barcode form. The explanation of "B field" barcodes would try
your patience beyond the limit. If you are really interested in these types
of barcodes please contact me.

POSTNT.EXE was written by Dave Barrett, CS 76314,1004
This program is put in the public domain with the following
1) If you make any improvements to the program please post them
so others can enjoy them.
2) This program must be distributed without charge whether used
alone or included as part of another program.
3) Please include this file, POSTNT.DOC, along with the program.

Dave Barrett CS 76314,1004
13760 80th St So
Hastings MN 55033-9407

(D) 612-293-3318
(E) 612-436-6970

 December 23, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>