The laser barcoding for code 128 series C is a bit tricky. Series C is designed to encode digit pairs rather than full text values, and as a result requires that the data being barcoded is mapped into different values. The algorithm for this is easy, once it is understood. Each byte pair is treated as a printable ASCII value. Here is a user-defined function that can be embedded into any code block, such as prejob:

prejob{


def fncodec$(local wx$)

local wxr$=""

while wx$>""

if len(wx$)=1 then wxr$+=chr(133)+wx$;break

wxr$=wxr$+chr(32+num(wx$(1,2)))

wx$=wx$(3)

wend

return wxr$

end def


}


Then, when you need to barcode a value (which should always be an even number of digits, you can use a command like this:

barcode 1,9,{fncodec$(get(1,8,10))},610,150,4


The function, above, handles odd numbers of digits by inserting a "Code A" character in front of the last digit. This results in  interpretation of the last digit in the series A character set, allowing odd numbers of characters.

There are some barcode requirements that also require FNC values prefixing the compressed (series C) or uncompressed data. For series A and B, the FNC1 through FNC4 values can be inserted with CHR(102), CHR(97), CHR(96), and CHR(101), respectively. For series C, simply add 32 to these values, such as CHR(134) for FNC1.

Note that if you need to place the barcode in an exec function, then there is a possibility that the barcode data will confuse the parser by adding a backslash at the end, right before the closing quote, and commas in the middle. To get around this, use the HTA function and $xx$ literal representation:

exec("barcode 2,62,$"+hta(fncodec$(get(1,8,10)))+"$,610,150,4")