How to read variable length application identifiers in .zpl datamatrix in VB6?

Viewed 395

According to GS1 standards (http://www.databar-barcode.info/application-identifiers/) a variable length field in a barcode should have a break sign to signal when it ends.

Code for the .zpl printer in my test is as follows:

^BY200,200^FT250,860^BXN,12,200,0,0,6,~ ^FH\^FD\7E10012345678912345678910123\7E1151606013712\7E1^FS

This was written according to (http://www.servopack.de/support/zebra/ZPLbasics.pdf) and when I scan it into Notepad++ I see that the breaks are applied in the code as shown in the picture below.

Scanned datamatrix in notepad++

But when I try to scan it in my VB6 application it doesn't appear to catch the break sign and writes everything from 10 (batch number) and forward into the batchnumber instead of breaking before 15 (expiration date).

My code looks like this:

ElseIf Left(Data, 2) = AI_BATCH Or Left(Data, 6) = "<GS>10" Or Left(Data, 3) = "~10" Then
        If Left(Data, 2) = AI_BATCH Then
            Data = Mid(Data, 3)
        ElseIf Left(Data, 6) = "<GS>10" Then
            Data = Mid(Data, 7)
        ElseIf Left(Data, 3) = "~10" Then
            Data = Mid(Data, 4)
        End If

        '   Calculate length 
        While Mid(Data, AI_BATCH_LEN + 1, 1) <> "" And Mid(Data, AI_BATCH_LEN + 1, 1) <> "~" And Mid(Data, AI_BATCH_LEN + 1, 1) <> "<"
            AI_BATCH_LEN = AI_BATCH_LEN + 1
        Wend

        gs1.batch = Trim(Left(Data, AI_BATCH_LEN))
        Data = Mid(Data, 1 + AI_BATCH_LEN)

Thanks in advance.

1 Answers
Related