This is the online manual of GRCTools, personal name and address management software.  Click here for details.




Sorting code - parse & standardise

GRCTools manual | Index

Purpose: to identify numbers and strings indicating sorting codes and to move these codes into a new field, standardizing the format at the same time. For certain countries, sorting code may be assigned if not found within the user-specified field.

In many countries, a sorting code is added, usually after the town name, to allow the post office of the relevant country to send the mail to the correct office for sorting. This code can consist of a string (e.g. Paris Cédex), a number (e.g. Oslo 1), a combination of the two (e.g. Lille Cédex 2), or the name of a province (e.g. Milano (MI)).

Example: Lille Cedex 2 becomes Lille and Cédex 2.

image Sorting codes are defined in this program as any valid string written directly after, and on the same line as, the city name in an address, and used by postal services as a sorting code, though this may be a province or region name, for example.

The process searches first for strings indicating a sorting code and then searches for any numeric characters at the end of the field specified and adds these to the sorting code written. The string indicating sorting code must be preceded by and followed by at least one space in the user-defined field to be recognized.

Information required: For each field chosen, GRC ToolsTMneeds to know if the data in the field is to be written in upper or mixed (upper and lower) case; and the field to which to move the sorting code.


In certain countries the sorting code, if not found elsewhere in the address, can be assigned on the basis of the postal code. For this reason, the field containing the postal code must be specified.


image In countries where the sorting code is an administrative district, such as Spain and Italy, many of the names of the administrative districts are the same as those of a city within it. To prevent the city name itself from being mistaken for a province name and being moved to a different field, the lookup tables used will not contain the city name as it would be written as a city. Thus for Italy, the lookup table may contain MI, the correct sorting code abbreviation for the province of Milano, or (Milano) as the city name will never be found between brackets, but not Milano.