Scanning Zebra Printed ZPL CODE-128 Barcode not returning single integer value for AI(37) but works if value is two integers? - barcode

I am trying to print a GS1-128 Barcode using ZPL and when I print this out for some reason everything prints fine except the number in the AI (37), I get 3715 (the 4 is missing), if I change the 4 to a two char integer value such as 04 or 14 I am able to scan it in the barcode.
^BCN,390,N,N,N
^FD>;>8(02)19410525013094(37)4>8(15)200330>610BAT100^FS
The only issue is the system I am working with stores the value for AI 37 as integers, so if the QTY is 4 then it will print as a 4, but i am getting nothing at the moment.
Any assistance would be appreciated.
Thank you,
Omeil

You are manually selecting the numeric mode of code128, using >; at the start of the data field. Numeric mode encodes pairs of digits into single codewords. And unfortunately the printer silently drops any unpaired digits.
You must either zero-pad your data when in subset-C or switch to ZPL's automatic mode for code128, which does a good job at minimizing symbol length. For your data, keep the >; start mode and then let the automatic-mode shift or latch to subset-B as needed.

The answer seems to be replacing >8 with >6 for AI 37 to print quantities of single or odd digits! eg 4, 103, etc

Related

ZPL Barcode missing front 2 digit

I am trying to print an EAN barcode vertically on a label with below ZPL code:
^FO895,273^BY3^BUB,200,Y,N
^FO895,261^FD9827755779090^FS
I'm expecting the output as 9827755779090. However, it prints out as 277557790900.
It cuts off the first 2 digit(98) and adds (0) on the final digit. Can I know how do I fix my code?
^BE is the EAN command. It will calculate the check digit for you.
^BE; EAN-13 Bar Code. Description: The ^BE command is similar to the
UPC-A bar code. It is widely used throughout Europe and Japan in the
retail marketplace. The EAN-13 bar code has 12 data characters, one
more data character than the UPC-A code. An EAN-13 symbol contains the
same number of bars as the UPC-A, but encodes a 13th digit into a
parity pattern of the left-hand six digits. This 13th digit, in
combination with the 12th digit, represents a country code. • ^BE
supports fixed print ratios. • Field data (^FD) is limited to exactly
12 characters. ZPL II automatically truncates or pads on the left with
zeros to achieve the required number of characters.
Here is the fixed code (with changed ^FO).
^XA
^FO95,273^BY3^BEB,200,Y,N
^FD9827755779090^FS
^XZ
You are feeding the barcode more data than the specification is set for.
Plus, you are not creating an EAN code, but a UPC(12).
Specification :
UPC (technically refers to UPC-A) consists of 12 digits
Specification of ZPL II on UPC-A (code ^BU) section 5.34 specifically states:
^FD : exactly 11 characters. ZPL II auto-truncates or pads ON THE LEFT with 0 to achieve required number of characters.
(I added italics)
So you get
^FO895,261^FD9827755779090^FS
----------- << these 11 digits
It just so happens that the UPC checksum of 27755779090 is 0
This is why you would get same result for ^FO895,261^FD999999988889827755779090^FS
To get exactly what you want, use
^FO895,261^FD98277557790^FS
.. this will get a checksum of 4

How to encode a TAB character in a Code128 barcode using only raw ZPL

In the past, we've used ZPL to create Code39 barcodes with a TAB character encoded in the middle using something similar to the following:
*USERNAME$IPASSWORD*
The $I in the middle gets translated to a TAB by the barcode scanners we use.
Now we have a need to do the same thing, but using Code128. With Code39, all the text needs to be uppercase (unless you're using Code39Extended, which supports lowercase letters). Because some of the data that is going to be encoded will be lowercase, we need to use Code128 B for most of the barcode, switching to Code128 A in the middle to encode the TAB character, then back to Code128 B for the final part.
Looking through the "ZPL II Programming Guide", it should be as easy as:
>:username>7{TAB}>6PA55w0rd
The >: at the beginning sets the subset to B, the >7 changes the subset to A, and the >6 changes the subset back to B. The problem I'm having (and haven't found a solution after almost a week of searching) is: How do I encode a TAB character using only text?
Use the ^FH (field hexidecimal encoding) command immediately prior to your field data. Based on your example:
^FH_^FD>:username>7_09>6PA55w0rd^FS
Where the underscore '_' is used as the escape character and 09 is the hex value for tab.
Also note that if the chosen escape character appears in the user name or password, you will need to escape it as well.
I tried what Mark Warren suggested, but unfortunately, it didn't work. It did, however, get me looking back through the ZPL II Programming Guide and I found the following, which I had overlooked before:
Code 128, Subsets A and C are programmed in pairs of digits, 00 to 99, in the field data string.
...
In Subset A, each pair of digits results in a single character being encoded in the bar code...
So, since 73 equates to a TAB in Subset A, I tried the following:
>:username>773>6PA55w0rd
And it worked!

How to create a GS1-128 barcode using ZPL with a check digit

I need to generate a GS1-128 barcode using ZPL. It needs to include a check digit. I do not seem to get the check digit.
Here is my code:
^BCN,088,Y,Y,Y,D^FD(00)00123456000057763^FS
The first "Y" is saying to print the human readable along with the
barcode. The third "Y" is supposed to tell it to include a check digit.
I'm not seeing the check digit in the human readable, my scanner is not
displaying a check digit, so I'm assuming it is also not in the barcode?
Here is from the spec:
SSCC Barcode Structure (20 digits)
Application Identifier = (00)
Positions of SSCC barcode:
1 = Extension Digit (0-9 assigned by Vendor)
2 = 0 if mfg id # assigned by GS1 US;
1-9 if mfg id # assigned by another GS1 MO
3 thru 8 = 6-digit mfg id #
9 thru 17 = 9-digit serial id # -must be unique for one year
18 = Modulo 10 check character
TLDR;
^BCN,088,Y,Y,,D
^FD(00)001234560000577630^FS
The third Y does include a Checkdigit, but not the one you want (ZPL Manual, p73):
Mod 103 check digit is always there. It cannot be turned on or off. Mod 10 and 103 appear together with [the third Y] turned on.
When you use D, it will automatically add a checkdigit(ZPL Manual, p80):
The printer automatically
determines if a check digit is required, calculate it, and print it.
But more importantly, it expects you to send 18 digits :
Parentheses and spaces can be in the field data. '00' application identifier, followed
by 17 characters, followed by bogus check digit place holder.
It'll strip out the 18th digit and replace it in both the barcode and the human readable part.
https://www.zebra.com/content/dam/zebra/manuals/printers/common/programming/zpl-zbi2-pm-en.pdf

How to control the width of ZPL alphanumeric code 128 barcode

I am printing a code 128 barcode in ZPL, which must be 78mm. The following numeric barcode works as expected:
^XA^FO141,330^BY3,3,^BCR,243,Y,N,N,A^FD12001752107481808006410360011596^FS^XZ
But changing one number to 'X' near the end of the barcode, means the barcode is now printed as 91mm:
^XA^FO141,330^BY3,3,^BCR,243,Y,N,N,A^FD1200175210748180800641036001X596^FS^XZ
Changing the barcode module with from 3 to 2 with ^BY2 makes the barcode 60mm which is not acceptable.
Any suggestions?
Code 128 has different Subtypes. One of them can encode two numbers in one barcode-character. Your Zebra optimizes your barcode because you use the
^BCo,h,f,g,e,m
Command with Parameter m = mode set to
A = Automatic Mode
This analyzes the data sent and automatically
determines the best packing method. The full
ASCII character set can be used in the ^FD
statement — the printer determines when to shift
subsets. A string of four or more numeric digits
causes an automatic shift to Subset C.
Switching modes and printing alphanumeric makes your barcode longer.

ZPL - Barcode Missing a digit when printed

I am trying to print a Code 128 barcode on a label using the following the piece of ZPL with a Zebra ZP 450 printer:
^BY3^BCN,112,N^FO090,660^FD>;>89102100^FS
I'm expecting the barcode to scan as "9102100". However, when I scan the printed barcode, it reads as "910210" -- cutting off the final digit.
If I change the last digit, it is still cut off. But if I add more digits onto the end, e.g. "9102100357", the barcode correctly reads as "9102100357".
Why am I "losing" a digit in this particular case?
The >; inside of your ^FD block is telling the code 128 barcode to go into a subset (subset C in this case) which forces the data in the barcode to be numeric pairs (00 - 99). Any data that is not supplied in numeric pairs is ignored. If you put a letter in there, it will ignore that pair. In your case 9102100 has an odd number of numbers, so it ignores the last one. If for example, you add another 0, it will put all the letters in the barcode.
The ;> which puts the barcode in Subset C is not the default. Subset B or :> is the default which will allow any character to be encoded in the barcode. So you can replace the ;> with :>, or just remove the ;> entirely, and it will print out properly.
Check out the ^BC documentation in the ZPL programming manual for more information about Code 128 subsets and data validation
See pg 92 of the ZPL Programming Guide.
This issue may have been fixed in the firmware update, see below:
Example: This is an example with the mode parameter set to D*:
^XA
^PON
^LH0,0
^BY2,2.5,145
^FO218,343
^BCB,,Y,N,N,D
^FD(91)0005886>8(10)0000410549>8(99)05^FS
^XZ
D* — When trying to print the last Application Identifier with an odd number of characters, a problem
existed when printing EAN128 bar codes using Mode D. The problem was fixed in firmware version
V60.13.0.6."

Resources