How concat multiple fields for a GS1 Data-matrix (BXN) in Zebra Programming Lang (ZPL) - qr-code

I'm trying to show some data in a GS1 Datamatrix which has field separators (FNC1,GS) pass within the variable to a zpl template.
Originally, in ZebraDesigner I couldn't get zpl to allow me to pass the separators within the parameter/variable. The separators would only show as text within the data, not as control characters for the scanner. (I was able to pass the separators as Fix Data, however it needs to work with a parameter).
Alternatively, I was hoping to edit the zpl and concatenate the control characters and QR values into one printed data for the Datamatrix.
This is zpl using one variable QRCode: (This works but not with passed separators)
^BY208,208^FT448,1123^BXN,8,200,0,0,1,~
^FH\^FN18^FDQRCode^FS
This is using fixed data where FNC1 is \7E and GS is \1D: (This works but doesn't use variables/parameters)
^BY208,208^FT448,1123^BXN,8,200,0,0,1,~
^FH\^FD\7E188text234567890\1Dmoretext^FS
This is my attempt to concat the separators and variables QRData1...:
^BY208,208^FT448,1123^BXN,8,200,0,0,1,~
^FH\^FD\7E^FN18^FDQRData1^FN22^FD\1D^FDQRData2^FD\1D^FN23^FDQRData3^FS
Unfortunately, the QR code only shows the value for the last var QRData3

Escape your field seperator hex codes with an _ (underscore), not with a backslash.
And use only one ^FD command like in your second example.
For reference see the pages of the commands ^FD, ^FH and ^BX in the Zebra ZPL II Programming Giude
As the OP found out, the field seperator _d029 worked for him! This is the hex value (0xD029) for the control character.
More information can be found here:
Encode GS,RS, and EOT for Code 128 and PDF417
GS is ~029
RS is ~030
EOT is ~004
Example:
[)><RS>06<GS>13V12GG7<GS>1P029-102489-157<GS>NC-411-661478-1<RS><EOT>
Enter the data as:
[)>~03006~d02913V12GG7~0291P029-102489-157~029NC-411-661478-1~030~004
Encode GS,RS, and EOT for Data Matrix, Aztec, and QR Code
GS is ~d029
RS is ~d030
EOT is ~d004
Example:
[)><RS>06<GS>13V12GG7<GS>1P029-102489-157<GS>NC-411-661478-1<RS><EOT>
Enter the data as:
[)>~d03006~d02913V12GG7~d0291P029-102489-157~d029NC-411-661478-1~d030~d004

Related

ZPL - How to embed GS1 application identifiers into GS1 QR code

I'm trying to code a GS1 compliant QR code in ZPL which will inlcude a number of application identifiers. I don't understand how to embed the FNC1 character within the ^FD string when using ^BQ to create a 2d code.
Below is my first attempt. When creating a GS1-128 barcode, I would use the >8 character to denote variable length fields.
^FX Test^FS
^XA^MCY^XZ
^XA^LH0,65
^LH0,0^FS
^BQN,2,10^FD>;>83018099999>82411184174>810MFATA00001>891EA^FS
^PQ1,0,0,N
^XZ
This creates a 2d barcode that returns the following string when scanned, but is not recoginised as GS1 compliant.
11611193018099999>82411184174>810MFATA00001>891EA
How do I configure the ^FD field to enable the FNC1 character?
QR ZPL Issues
See a recent answer I had for QR codes here:
Print ZPLII QR to open url
You are missing some of the parameters for the ^BQ and ^FD commands.
GS1 QR Issues
Research I've done indicates that the GS1 QR code is quite proprietary, and does not seem to be easily generated with ZPL. However, you can use a Data Matrix barcode quite easily.
Looks like you are trying to create a code with the following Application Identifiers and values:
30: Variable Count of Items: 18099999
241: Variable Customer Part Number: 1184174
10: Variable Batch/Lot Number: MFATA00001
91: Variable Company Internal: EA
GTIN 01 seems to be required and is missing. I've added a temporary GTIN string. Customer part number 241 seems to be local only, and may not validate in some applications which validate global requirements.
Full Barcode String.
^FD_10112345678901234_110MFATA00001_13018099999_12411184174_191EA^FS
Full ZPL for sample label
^XA
^FO10,10
^BXN,9,200,40,40,,_
^FD_10112345678901234_110MFATA00001_13018099999_12411184174_191EA^FS
^XZ
Hope that helps.
https://www.gs1.org/docs/barcodes/GSCN_16_477_FNC1.pdf
https://www.zebra.com/us/en/support-downloads/knowledge-articles/creating-gs1-barcodes-with-zebra-printers-for-data-matrix-and-code-128-using-zpl.html
EdHayes3's answer is just great.
As specified by Zebra in a ^BX the escape character is the underscore and the subsequent number defines what kind of FNC is used.
_1 - > FNC1
_2 - > FNC2
_3 - > FNC3
FNC4 is not supported according to how I understand the Zebra documentation.
The only thing I do not entirely agree with is escaping every GS1 AI since the most common ones except Lot/Batch number have a fixed length.
In other words, I do not think that it is necessary to escape for example the GTIN. Though, you probably have to keep in mind to pad it up with leading zeros in case of GTIN-12 or GTIN-13.

Why does contents of ^FN1 in ZPL not show all content when used in ^BQ command with ^FD?

I am looking for some direction here, as I seem to be missing something. I have the following ZPL that is loaded into a ZD620:
^XA
^LH0,0^LRN^FT100,50,0^A0N,30,30^FN1^FDCORELIMS.BARCODE^FS
^FO471,27^BQN,1,3^FDQA,^FN1^FS
^FT381,188^A0N,50,68^FD^FN1^FS
^XZ
I use an off-the-shelf software that turns CORELIMS.BARCODE into the entity's barcode value to be encoded. That works fine. What is not happening, when the Generated QR Code is scanned, the output is always missing the first 3 characters. What should show up is something like: 5BX10, what I get is: 10.
During my troubleshooting I used the following code and I receive the full string:
^XA
^LH0,0^LRN^FT100,50,0^A0N,30,30^FN1^FDCORELIMS.BARCODE^FS
^FO471,27^BQN,1,3^FDQA,5BX10^FS
^FT381,188^A0N,50,68^FD^FN1^FS
^XZ
All other fields using the ^FN1 command (including this one: ^FT381,188^A0N,50,68^FD^FN1^FS) output the correct value, just not the generated QR code.
I found similar questions, however, none of which are using a ^FN command, and their suggestions do not work for my situation. Those links are listed here:
Print ZPLII QR to open url
ZPL QR code not printing what is in the string
Thanks for help and I would really like to learn what I am doing wrong.
The ^FNx commands are used with stored formats; they cannot be used in a "one-off" label format like you are showing. I am traveling and don't have a zebra printer to test this but basically you need to define the label format "template" using ^DF like:
^XA
^DFR:MYFORMAT.ZPL^FS
^LH0,0^LRN^FT100,50,0^A0N,30,30
^FO471,27^BQN,1,3^FN1^FS
^FT381,188^A0N,50,68^FN1^FS
^XZ
That stores the format as R:MYFORMAT.ZPL. Then you use ^XF to recall the format and provide the values for the ^FNx:
^XA
^XFR:MYFORMAT.ZPL^FS
^FN1^FDQA,CORELIMS.BARCODE^FS
^XZ
Note that you include the extra data params required by ^BQ in the ^FD string.
Hope that helps.

convert comment string to an ASCII character list in sicstus-prolog

currently I am working on comparison between SICStus3 and SICStus4 but I got one issue that is SICStus4 will not consult any cases where the comment string has carriage controls or tab characters etc as given below.
Example case as given below.It has 3 arguments with comma delimiter.
case('pr_ua_sfochi',"
Response:
answer(amount(2370.09,usd),[[01AUG06SFO UA CHI Q9.30 1085.58FUA2SFS UA SFO Q9.30 1085.58FUA2SFS NUC2189.76END ROE1.0 XT USD 180.33 ZPSFOCHI 164.23US6.60ZP5.00AY XF4.50SFO4.5]],amount(2189.76,usd),amount(2189.76,usd),amount(180.33,usd),[[fua2sfs,fua2sfs]],amount(6.6,usd),amount(4.5,usd),amount(0.0,usd),amount(18.6,usd),lasttktdate([20061002]),lastdateafterres(200712282]),[[fic_ticketinfo(fare(fua2sfs),fic([]),nvb([]),nva([]),tktiss([]),penalty([]),tktendorsement([]),tourinfo([]),infomsgs([])),fic_ticketinfo(fare(fua2sfs),fic([]),nvb([]),nva([]),tktiss([]),penalty([]),tktendorsement([]),tourinfo([]),infomsgs([]))]],<>,<>,cat35(cat35info([])))
.
02/20/2006 17:05:10 Transaction 35 served by static.static.server1 (usclsefat002:7551) running E*Fare version $Name: build-2006-02-19-1900 $
",price(pnr(
user('atl','1y',<>,<>,dept(<>,'0005300'),<>,<>,<>),
[
passenger(adt,1,[ptconly(n)])
],
[
segment(1,sfo,chi,'ua','<>','100',20140901,0800,f,20140901,2100,'737',res(20140628,1316),hk,pf2(n,[],[],n),<>,flags(no,no,no,no,no,no,no,no,no)),
segment(2,chi,sfo,'ua','<>','101',20140906,1000,f,20140906,1400,'737',res(20140628,1316),hk,pf2(n,[],[],n),<>,flags(no,no,no,no,no,no,no,no,no))
]),[
rebook(n),
ticket(20140301,131659),
dbaccess(20140301,131659),
platingcarrier('ua'),
tax_exempt([]),
trapparm("trap:ffil"),
city(y)
])).
The below predicate will remove comment section in above case.
flatten-cases :-
getmessage(M1),
write_flattened_case(M1),
flatten-cases.
flatten-cases.
write_flattened_case(M1):-
M1 = case(Case,_Comment,Entry),!,
M2 = case(Case,Entry),
writeq(M2),write('.'),nl.
getmessage(M) :-
read(M),
!,
M \== end_of_file.
:- flatten-cases.
Now my requirement is to convert the comment string to an ASCII character list.
Layout characters other than a regular space cannot occur literally in a quoted atom or a double quoted list. This is a requirement of the ISO standard and is fully implemented in SICStus since 3.9.0 invoking SICStus 3 with the option --iso. Since SICStus 4 only ISO syntax is supported.
You need to insert \n and \t accordingly. So instead of
log('Response:
yes'). % BAD!
Now write
log('Response:\n\tyes').
Or, to make it better readable use a continuation escape sequence:
log('Response:\n\
\tyes').
Note that using literal tabs and literal newlines is highly problematic. On a printout you do not see them! Think of 'A \nB' which would not show the trailing spaces nor trailing tabs.
But there are also many other situations like: Making a screenshot of program text, making a photo of program text, using a 3270 terminal emulator and copying the output. In the past, punched cards. The text-mode when reading files (which was originally motivated by punched cards). Similar arguments hold for the tabulator which comes from typewriters with their manually settable tab stops.
And then on SO it is quite difficult to type in a TAB. The browser refuses to type it (very wisely), and if you copy it in, you get it rendered as spaces.
If I am at it, there is also another problem. The name flatten-case should rather be written flatten_case.

readcsv fails to read # character in Julia

I've been using asd=readcsv(filename) to read a csv file in Julia.
The first row of the csv file contains strings which describe the column contents; the rest of the data is a mix of integers and floats. readcsv reads the numbers just fine, but only reads the first 4+1/2 string entries.
After that, it renders "". If I ask the REPL to display asd[1,:], it tells me it is 1x65 Array{Any,2}.
The fifth column in the first row of the csv file (this seems to be the entry it chokes on) is APP #1 bias voltage [V]; but asd[1,5] is just APP . So it looks to me as though readcsv has choked on the "#" character.
I tried using "quotes=false" keyword in readcsv, but it didn't help.
I used to use xlsread in Matlab and it worked fine.
Has anybody out there seen this sort of thing before?
The comment character in Julia is #, and this applies when reading files from delimited text files.
But luckily, the readcsv() and readdlm() functions have an optional argument to help in these situations.
You should try readcsv(filename; comment_char = '/').
Of course, the example above assumes that you don't have any / characters in your first line. If you do, then you'll have to change that / above to something else.

How to convert IBM file to hexadecimal using DFSORT?

I'm trying to pass a IBM file to hex values.
With this input:
H800
Would save this output in a file:
48383030
I tried by this way:
//R45ORF80V JOB (EFAS,2SGJ000),'LLAMI',NOTIFY=R45ORF80,
// MSGLEVEL=(1,1),MSGCLASS=X,CLASS=A,
// REGION=0M,TIME=5
//*---------------------------------------------------
//SORTEST EXEC PGM=ICEMAN
//SORTIN DD DSN=LF58.DFE.V1408001,DISP=SHR
//SORTOUT DD DSN=LF58.DFE.V1408001.OUT,
// DISP=(NEW,CATLG,DELETE),
// LRECL=4,DATACLAS=CDMULTI
//SYSOUT DD SYSOUT=X
//SYSPRINT DD SYSOUT=X
//SYSUDUMP DD SYSOUT=X
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,4,HEX)
END
/*
But it outputs the following:
C8F1F0F0
What am I doing wrong?
Is posible to convert to hexadecimal a file with 500 of LREC with COMP-3 fields too?
Just by the way I could use "HEX" command while I browse a file using file manager.
Your control cards are giving you the output you have asked for. They are showing you the hexadecimal values of those characters in EBCDIC, not in ASCII, the hexadecimal values you are expecting.
If you actually want to see the ASCII equivalent, use TRAN=ETOA, then TRAN=HEX.
You are using OUTREC FIELDS. FIELDS has a new synonym (from exactly 10 years) which is BUILD. FIELDS is supported for backwards compatibility.
INREC and OUTREC are similar, INREC operates before a SORT or MERGE, OUTREC afterwards.
What I recommend, unless you need to be doing it after a SORT/MERGE, is to use INREC.
So:
INREC BUILD=(1,4,TRAN=ETOA)
But, there is no need to use BUILD. BUILD always creates a new version of the record. Many times this is what you want when you are rearranging fields. Here, you are not.
INREC OVERLAY=(1,4,TRAN=ETOA)
If you replace your OUTREC with that, your output file will be encoded in ASCII.
If you want to see the ASCII as well:
INREC OVERLAY=(1,4,TRAN=ETOA,1,4,TRAN=HEX)
If you want to see the ASCII instead:
INREC OVERLAY=(1,4,TRAN=ETOA,1:1,4,TRAN=HEX)
Note the 1: in the last example. This says "the results are going to be at position 1", so overwriting your previous converted data. OVERLAY can do that, BUILD cannot in one statement.

Resources