Jump to content

S10 (UPU standard)

From Wikipedia, the free encyclopedia
The 13-character identifier for a package. It starts with the service indicator for registered mail ("RR"), followed by an 8-digit serial number (28704377), the check-digit (5) and the two-letter ISO country code for the issuing country, India ("IN")

The UPU S10 standard defines a system for assigning 13-character identifiers to international postal items for the purpose of tracking and tracing them during shipping.

With increased liberalization and the possibility of multiple postal services operating in the same country, the use of country codes to designate the postal service is a problem. To solve this, each country has a designated postal service that controls all S10 identifiers from that country; any competing postal services will have to cooperate with the designated owner. The 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.

Format

[edit]

The identifiers consist of a two-letter service indicator code, an eight-digit serial number (in the range 00000000 to 99999999), a single check-digit, and a two-letter ISO country code identifying the issuing postal administration's country.[1]

S10 format
1 2 3 4
AA 00000000 9 BB
  1. Service indicator code (see below)
  2. Serial number
  3. Check-digit (see below)
  4. ISO 3166-1 alpha-2 country code

Service indicator codes

[edit]

Service codes are generally assigned and administered within each issuing country, but certain types of service and code ranges are used for all countries as listed here.

Code Interpretation[1]
AA–AU Unassigned[a]
AV–AZ Domestic, bilateral, multilateral use only[b]
BA–BZ Domestic, bilateral, multilateral use only
CA–CZ Parcel post
  • The use of CV is recommended (though not required) for insured parcels[c]
  • The use of CZ requires bilateral agreement
DA–DZ Domestic, bilateral, multilateral use only
EA–EZ EMS
  • The use of EX–EZ requires bilateral agreement
FA–FZ Unassigned[a]
GA Domestic, bilateral, multilateral use only
GB–GC Unassigned[a]
GD Domestic, bilateral, multilateral use only
GE–GZ Unassigned[a]
HA–HZ E-commerce parcels
  • The use of HX–HY requires multilateral agreement
  • The use of HZ requires bilateral agreement
IA–IZ Unassigned[a]
JA–JZ Reserved[d]
KA–KZ Reserved[d]
LA–LZ Letter post tracked
  • The use of LZ requires bilateral agreement
MA–MZ Letter post M bags
NA–NZ Domestic, bilateral, multilateral use only
OA–OZ Unassigned[a]
PA–PZ Domestic, bilateral, multilateral use only
QA–QM International Business Reply Service
QN–QZ Unassigned[a]
RA–RZ Letter post registered
  • The use of RZ requires bilateral agreement.
SA–SZ Reserved[d]
TA–TZ Reserved[d]
UA–UZ Letter post items (when L, M, Q, R and V codes don't apply)[e]
  • The use of UZ requires bilateral agreement
VA–VZ Letter post insured
  • The use of VZ requires bilateral agreement
WA–WZ Reserved[d]
XA–XZ Unassigned[a]
YA–YZ Unassigned[a]
ZA–ZZ Domestic, bilateral, multilateral use only

Check-digit calculation

[edit]
  1. Ignore the service indicator code and country code.
  2. Assign the weights 8, 6, 4, 2, 3, 5, 9, 7 to the 8 digits, from left to right.
  3. Calculate S, the sum of each digit multiplied by its weight.
    • For example, for the number 47312482: S = 4×8 + 7×6 + 3×4 + 1×2 + 2×3 + 4×5 + 8×9 + 2×7 = 200.
  4. Calculate the check digit C = 11 − (S mod 11).
    • If C = 10, change to C = 0.
    • If C = 11, change to C = 5.
    • For the example 47312482, C = 11 − (200 mod 11) = 11 − 2 = 9.

Python code for check-digit calculation

[edit]

For Python 3.6 or later:

def get_check_digit(num: int) -> int:
    """Get S10 check digit."""
    weights = [8, 6, 4, 2, 3, 5, 9, 7]
    sum = 0
    for i, digit in enumerate(f"{num:08}"):
        sum += weights[i] * int(digit)
    sum = 11 - (sum % 11)
    if sum == 10:
        sum = 0
    elif sum == 11:
        sum = 5
    return sum

JavaScript code for check-digit calculation

[edit]
function getCheckDigit(num) {
    const weights = [8, 6, 4, 2, 3, 5, 9, 7];
    const numArr = Array.from(String(num), Number);
    let sum = 0;
    numArr.forEach((n, i) => sum = sum + (n * weights[i]));
    sum = 11 - (sum % 11);
    if (sum == 10) sum = 0;
    else if (sum == 11) sum = 5;
    return sum;
}

Haskell code for check-digit calculation

[edit]
checkDigit :: [Int] -> Int
checkDigit ns
    | c == 11 = 5
    | c == 10 = 0
    | otherwise = c
    where weights = [8, 6, 4, 2, 3, 5, 9, 7]
          s = sum $ zipWith (*) weights ns
          c = 11 - (s `mod` 11)

See also

[edit]

Notes

[edit]
  1. ^ a b c d e f g h i "Any combinations of two alphabetic characters that are not yet assigned for universal use, nor allocated for exclusively domestic/bilateral/multilateral use, may be assigned under the authority of the UPU's Standards Board" (p.2)[1]
  2. ^ "In principle, the use of code range AV–AZ is to identify RFID-tracked items." (p.4)[1]
  3. ^ "Thus: a) insured parcels might have a service indicator other than CV; and b) service indicator CV does not necessarily imply that the parcel is an insured one." (p.4)[1]
  4. ^ a b c d e "To reduce the risk of confusion between S10 identifier barcodes and barcodes which make use of ISO/IEC 15418 data identifiers, character combinations JA–JZ; KA–KZ; SA–SZ; TA–TZ and WA–WZ are reserved and cannot be assigned as valid service indicator values." (p.2)[1]
  5. ^ "The use of code range UA–UZ is for letter-post items containing goods requiring an S10 identifier and without customer-oriented tracking. The identifier is used for visibility in the supply chain, for example in an ITMATT message for electronic advance data." (p.4)[1]

References

[edit]
  1. ^ a b c d e f g "S10 Identification of postal items – 13-character identifier" (PDF). UPU. 2017-10-17. Retrieved 2024-03-05.
[edit]