Link to home
Start Free TrialLog in
Avatar of spice_guy
spice_guyFlag for United States of America

asked on

Zebra ZPL-II Code 128 barcode with 3 Application Identifiers, including Serial Number

Hello,

I'm working on a label that goes on cases of our product, and the barcode needs to be Code 128 and have 3 elements:

  - GTIN (Application Identifier 01)
  - Batch Number (Application Identifier 10)
  - Serial Number (Application Identifier 21)

In particular, I'm having trouble with the Serial Number. We print thousands of these labels at a time, and the .prn files our software is generating are huge because it transmits multiple lines of code for each label.

I know the Zebra printers we use (140XiIII Plus) are capable of incrementing serial fields internally, which means that the software could send a tiny file with one copy of the label plus a quantity to print, and just let the printer increment the serial numbers. However, I can't figure out the correct syntax to make that work.

Here is a sample line in ZPL-II code that our software currently generates for the barcode:

  ^BY2^BCB,160,N,N^FD>;>80140012345012349101328>69C>5>82115300000>61^FS

I'm thinking that what I want is something like this (but this doesn't work):

  ^BY2^BCB,160,N,N^SN>;>80140012345012349101328>69C>5>82115300000>61,1,Y^FS

Can anyone provide the correct syntax?
Avatar of alexziv
alexziv

maybe zint can help
To initiate automatic serialization use combination of ^FD (Field Data) and ^SF (Serialization Field) commands and define fixed and variable parts of your serial number.

Referring to this please see page 250 in
ZPL II Programming Guide Volume One

Exercise 2. shows how to use ^FD and ^SF commands to define part of your barcode content which needs to be incremented...
Which part of your barcode data ">;>80140012345012349101328>69C>5>82115300000>61" is the variable part that needs to be incremented?

To make this clear please break down your serial data string into its elements...
Avatar of spice_guy

ASKER

Thanks for the responses! The last 5 digits are what need to be incremented, starting with "00001" and increasing by 1 on every label.

Later today I will try the commands you mention in your first post and let you know the results.

Here's the breakdown you requested of all the different parts in my command string:

^BY                        Bar Code Field Default Instruction
2                            (Parameter) Narrow Bar width = 2 dots
^BC                        Bar Code 128
B,                           (Parameter)  Orientation = rotated 270 degrees
160,                       (Parameter) Height = 160 dots
N,                           (Parameter) Print Interpretation Line = no
N                            (Parameter) Inverted = no
^FD                        Field Data
>;                           Start Code 128 Subset C
>8                          FNC1
01                          Function Code 01 (Global Trade Item Number or GTIN)
40012345012349 Value for GTIN
10                          Function Code 10 (Lot ID)
1328>69C             Lot ID (note that only "13289C" prints - the ">6" changes to Subset B
                                    in order to handle the alpha character.)
>8                          FNC1
21                          Function Code 21 (Serial Number)
115300000>61    Serial number (the "115300" is static and "00001" is the part that
                                    increments. The ">6" changes to Subset B for the last digit
                                    because Subset C requires pairs of digits)
^FS                        Field Separator
Is it a four-digit or five-digit counter????

Something seems to be wrong with your above serial number description!

According to your description the serial number should be 1153000000>61, but your serial number example preceded by FNC1 and function code 21 says ">82115300000>1" with one missing digit for the static part and one for the variable part...

And what about the >5 in your example preceding the second FNC1?
ASKER CERTIFIED SOLUTION
Avatar of Thommy
Thommy
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@Thommy

I apologise for multiple errors that I made in my example, and I want to thank you for all the time you are taking to look at this in great detail.

  - The serial number should really have 4 static digits ("1153") and 5 variable digits ("00001").
     I'm afraid I got that wrong everywhere (and in different ways in different places).

  - The ">5" that I accidentally excluded from my breakdown would have forced a change to Subset C.

I still have not had time to try the commands you have provided, but I will get to them as quickly as I can and post the results.

Thanks again for all your time!
@Thommy

Your final suggestion worked! I had to tweak it a little bit for a couple of reasons.

First, my printer would not accept the lower-case "d" but was willing to accept the mask when I changed those to the upper-case "D".

Second, apparently it is important to make sure the length of the mask you provide in the ^SF string is EXACTLY the same length as your ^FD string. Your example had one extra "%". Note that you do need to include mask characters for the non-printable information such as the ">8" FNC1 characters.

Third, you need to put the ^FS (Field Separator) command at the end of the "^SF" string.

Here are my final strings (the ^SF one is so long it may wrap to another line):
^FD>;>80140012345012349101328>69C>5>82115300000>61
^SF%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%DDDD%%D,1^FS

Thanks, and I will award full points to your final answer!