PAF Data File - Full address:
The following explains how to read our optimised version of the postcode Address File or PAF data file. Our optimised version of the PAF data file is easy to word index using which ever SQL server you prefer.
How you use the Full address version of the PAF Data File
Usually the user enters a Postcode, and is then presented with a list of all Buildings, within the matching Postcode. The user then selects address from that list.
The PAF address is then entered into your web form
Our PAF File data format
Example of PAF Address record for 1 Postcode |
PostcodeTAB{Unique Part of each address for Postcode}Line 1-3 (see below)!Town|County|Postcode||Country|Delivery Point Sufix||Organisation Y/N|MailSort code|Spare field|||| |
The “Postcode” is stored in your own database field with an index. The rest of the PAF Data line can then be stored in a long text field (ntext). All words can be indexed to provide word search.
The “Spare field” contains additional data which may be of interest. More info
How to provide search
The user enters a postcode. You should then clean the Postcode format before doing the search. See FormatPostCode function contained in code.
Then simply find the address from the first field “Postcode” to then display a list of addresses at that postcode or on word search on PAF Data in second field.
To make the PAF Data file as small as possible, the Full address line first contains a list of Unique address parts, which make up the addresses list for a particular postcode. This is in the section enclosed in the "{}" section, each unique address line delimited by "!".
The section after the "{}" is followed by the common part of the address line:
Composition of PAF data for 1 Postcode |
{Unique parts of address lines} Common part of address !Town|County|Postcode |
All fields are delimited by "|" with a marker “!” before Town. The number of address lines in the unique part varies according to the address structure.
So to produce a list of address at a particular postcode:
- Read common part after the "}" store in Common Part of address up to !
- Then for each part of Unique Section:
- For each line, delimited by "!"
- read line upto "!", store in UniquePart
- Join UniquePart + " " + CommonPart
- Remove the part after “!” (“!Town|County|Postcode|Country”). And fill Town, County and Postcode.
- This leaves: “Organisation Name|Line 1|Line 2|Line 3|” and possibly “Line4|Line5…” (Line 4/5 can be ignored if need be). Fill fields Company Name and Line 1-3.
- Remove any space before or after each resulting data field
So for example
Example 1 |
{Organisation 1|No 1 !Organisation 2|No 2 !}Line 1|Line2|Line 3!Town|County|Postcode … |
Displays as:
Organisation 1|No 1 Line 1|Line2|Line 3!Town|County|Postcode
Organisation 2|No 2 Line 1|Line2|Line 3!Town|County|Postcode
Example 2 |
{Organisation 1|Top floor|No 1 !Organisation 2|Basement|No 2 !}Line2|Line 3!Town|County|Postcode |
Displays as:
Organisation 1|Top floor|No 1 Line2|Line 3!Town|County|Postcode
Organisation 2|Top floor|No 2 Line2|Line 3!Town|County|Postcode
Example PAF Data and Code
The Example download below contains a VBNET and a C# code example of how to convert the PAF data into an address list for display.
Download Examples (13Mb) |
See test postcodes for examples
Montly PAF File updates
You will receive an e-mail when an update is available for download.
Fast Import
The optimised PAF data file should be easily imported into two database fields, one for Postcode, and the other for the Full Royal Mail Address data, in minutes if using the Microsoft SQL Text import utility.
Please note: In accordance with Royal Mail Terms and Conditions, you must have a valid “Large business Package” license. We only supply this type of PAF data for a “Large business Package” license. Please call for the price of these licenses.