Home: Products: Royal Mail Barcode Fonts: Royal Mail Barcode Specifications:

RM4SCC Barcode Specifications

The RM4SCC barcode option is specified in IDAutomation Barcode Fonts, Components and Applications to create a RM4SCC barcode, which includes numbers and uppercase letters.

Using the RM4SCC barcode option with a font encoder returns text formatted to the RM4SCC Barcode Fonts. The VB function below may be used to generate the RM4SCC encoding for the barcode font.

Fig. 1. RM4SCC barcode function from the IDAutomation VB Barcode Font Encoder File.

Public Function RM4SCC(DataToEncode As String) As String
DataToEncode = UCase(DataToEncode)
OnlyCorrectData = ""
StringLength = Len(DataToEncode)
For I = 1 To StringLength
'Get each character one at a time
CurrentCharNum = AscW(Mid(DataToEncode, I, 1))
'Get the value of CurrentChar according to MOD43
'0-9
If CurrentCharNum < 58 And CurrentCharNum > 47
Then OnlyCorrectData = OnlyCorrectData & Mid(DataToEncode, I, 1)
'A-Z
If CurrentCharNum < 91 And CurrentCharNum > 64
Then OnlyCorrectData = OnlyCorrectData & Mid(DataToEncode, I, 1)
Next I
DataToEncode = OnlyCorrectData
Dim r As Integer
Dim C As Integer
Dim Rtotal As Long
Dim Ctotal As Long
Rtotal = 0
Ctotal = 0
WeightedTotal = 0
StringLength = Len(DataToEncode)
For I = 1 To StringLength
'Get each character one at a time
CurrentChar = Mid(DataToEncode, I, 1)
'Get the values of CurrentChar
Select Case CurrentChar
Case "0"
r = 1
C = 1
Case "1"
r = 1
C = 2
Case "2"
r = 1
C = 3
Case "3"
r = 1
C = 4
Case "4"
r = 1
C = 5
Case "5"
r = 1
C = 0
Case "6"
r = 2
C = 1
Case "7"
r = 2
C = 2
Case "8"
r = 2
C = 3
Case "9"
r = 2
C = 4
Case "A"
r = 2
C = 5
Case "B"
r = 2
C = 0
Case "C"
r = 3
C = 1
Case "D"
r = 3
C = 2
Case "E"
r = 3
C = 3
Case "F"
r = 3
C = 4
Case "G"
r = 3
C = 5
Case "H"
r = 3
C = 0
Case "I"
r = 4
C = 1
Case "J"
r = 4
C = 2
Case "K"
r = 4
C = 3
Case "L"
r = 4
C = 4
Case "M"
r = 4
C = 5
Case "N"
r = 4
C = 0
Case "O"
r = 5
C = 1
Case "P"
r = 5
C = 2
Case "Q"
r = 5
C = 3
Case "R"
r = 5
C = 4
Case "S"
r = 5
C = 5
Case "T"
r = 5
C = 0
Case "U"
r = 0
C = 1
Case "V"
r = 0
C = 2
Case "W"
r = 0
C = 3
Case "X"
r = 0
C = 4
Case "Y"
r = 0
C = 5
Case "Z"
r = 0
C = 0

End Select
'add the values together
Rtotal = Rtotal + r
Ctotal = Ctotal + C
Next I

'divide the Totals by 6 and get the remainder, this is a reference
'to the Check Digit.
'set check digit to CurrentChar (a string)
Rtotal = (Rtotal Mod 6)
Ctotal = (Ctotal Mod 6)
Select Case Rtotal
Case 1
Select Case Ctotal
Case 1
CurrentChar = "0"
Case 2
CurrentChar = "1"
Case 3
CurrentChar = "2"
Case 4
CurrentChar = "3"
Case 5
CurrentChar = "4"
Case 0
CurrentChar = "5"
End Select
Case 2
Select Case Ctotal
Case 1
CurrentChar = "6"
Case 2
CurrentChar = "7"
Case 3
CurrentChar = "8"
Case 4
CurrentChar = "9"
Case 5
CurrentChar = "A"
Case 0
CurrentChar = "B"
End Select
Case 3
Select Case Ctotal
Case 1
CurrentChar = "C"
Case 2
CurrentChar = "D"
Case 3
CurrentChar = "E"
Case 4
CurrentChar = "F"
Case 5
CurrentChar = "G"
Case 0br> CurrentChar = "H"
End Select
Case 4
Select Case Ctotal
Case 1
CurrentChar = "I"
Case 2
CurrentChar = "J"
Case 3
CurrentChar = "K"
Case 4
CurrentChar = "L"
Case 5
CurrentChar = "M"
Case 0
CurrentChar = "N"
End Select
Case 5
Select Case Ctotal
Case 1
CurrentChar = "O"
Case 2
CurrentChar = "P"
Case 3
CurrentChar = "Q"
Case 4
CurrentChar = "R"
Case 5
CurrentChar = "S"
Case 0
CurrentChar = "T"
End Select
Case 0
Select Case Ctotal
Case 1
CurrentChar = "U"
Case 2br> CurrentChar = "V"
Case 3
CurrentChar = "W"
Case 4
CurrentChar = "X"
Case 5
CurrentChar = "Y"
Case 0
CurrentChar = "Z"
End Select
End Select
'Return Printable String
RM4SCC = "(" & DataToEncode & CurrentChar & ")"
End Function
 

© Copyright 2001-2009 IDAutomation.com, Inc., All Rights Reserved. Legal Notices.

Over 70% of Fortune 100 companies use IDAutomation products to automate their businesses.