We print UCC serial shipping container barcodes in OCX mode. Here's how we do it.
First we turn off the Auto Checksum:
ASSIGN shPrinterVPE:BarcodeAutoChecksum = FALSE
Then we create a human-readable version of the barcode:
cBarcode[1] = "(00) 1 " + UCC + " " + STRING(skid-serial-number, "999999999") + " "
The UCC is a 7 digit identifier for the company and the skid serial number is a 9 digit skid identifier. A sample would be: (00) 1 1234567 123456789
Next we remove parentheses and spaces in order to generate a barcode value:
cBarcode[2] = REPLACE(cBarcode[1], "(", "")
cBarcode[2] = REPLACE(cBarcode[2], ")", "")
cBarcode[2] = REPLACE(cBarcode[2], " ", "")
Then we calculate a check digit modulo 10:
cCheck = STRING(CheckDigit10(cBarcode[2]))
We then add this check digit to both the barcode and the human readable versions:
cBarcode[1] = cBarcode[1] + cCheck
cBarcode[2] = cBarcode[2] + cCheck
Then we calculate a check digit modulo 103:
cCheck = STRING(CheckDigit128C(cBarcode[2]))
And finally we add this check digit to the barcode:
cBarcode[2] = cBarcode[2] + cCheck
My barcode sources are:
http://www.adams1.com/pub/russadam/spec.html
http://idautomation.com/code128faq.html#EAN128andUCC128
It may take a bit of digging to locate the proper formula for the check digit calculations.
As a last word, we've turned off the automatic check digit generation a long time ago and went this route. When we finally got it working we did not spend additional time in testing the automatic check sum generation from VPE; we may have incorrectly used it originally. But time constraints prevented proper testing.
Hopefully this helps.