Hi all,
I am trying to convert the ZPL data (which is base64 encoded) into normal ZPL format so that I can send it to printer for printing. I have written a very simple code using SYSTOOLS.BASE64DECODE() function from IBM - however the result I get is not the ZPL format. Here is my code -
File definition:
A R ZPLFMT
A INDATA 4096A
A OUTDATA 4096A CCSID(1208)
RPGLE code:
H dftactgrp(*no) actgrp(*new)
FZPLIN O A E Disk
D Cmd PR ExtPgm('QCMDEXC')
D 200A Options(*Varsize) Const
D 15P 5 Const
*
D Command S 200A
D InputBs64 S 4096A
D OputZpl S 4096A varying
*
/free
Command = 'CHGJOB CCSID(37)';
Cmd(Command: %len(%Trim(Command)));
InputBs64 = 'XkZTDQpeRk81MDUsMjkNCl5GQjI2NCw1LDAs'+
'QywwDQpeQTBOLDE5LDE5DQpeRkQ=';
Exec Sql
Set :OputZpl = SYSTOOLS.BASE64DECODE(:InputBs64);
clear outdata;
indata= InputBs64;
outdata= OputZpl;
write zplfmt;
*inlr = *on;
/end-free
I have been through some posts and this could be something to do with CCSID. However 819 did not work for me (I always got invalid CCSID error for that field) so tried to set the output field in database file to CCSID 1208. Here is the result -
dataurl324492.png
....5...10...15...20...25...30...35...40...45...50 ...55...60
';??■■;?|■■■■■■■■;??■■■■■■■■?■■■■; ■+■■■■■■■■;?? '
Can you please help me understand what is wrong?
Thank you in advance.
This is the expected result when I do this online -
^FS
^FO505,29
^FB264,5,0,4)y84)y
Regards, Gauri
I am trying to convert the ZPL data (which is base64 encoded) into normal ZPL format so that I can send it to printer for printing. I have written a very simple code using SYSTOOLS.BASE64DECODE() function from IBM - however the result I get is not the ZPL format. Here is my code -
File definition:
A R ZPLFMT
A INDATA 4096A
A OUTDATA 4096A CCSID(1208)
RPGLE code:
H dftactgrp(*no) actgrp(*new)
FZPLIN O A E Disk
D Cmd PR ExtPgm('QCMDEXC')
D 200A Options(*Varsize) Const
D 15P 5 Const
*
D Command S 200A
D InputBs64 S 4096A
D OputZpl S 4096A varying
*
/free
Command = 'CHGJOB CCSID(37)';
Cmd(Command: %len(%Trim(Command)));
InputBs64 = 'XkZTDQpeRk81MDUsMjkNCl5GQjI2NCw1LDAs'+
'QywwDQpeQTBOLDE5LDE5DQpeRkQ=';
Exec Sql
Set :OputZpl = SYSTOOLS.BASE64DECODE(:InputBs64);
clear outdata;
indata= InputBs64;
outdata= OputZpl;
write zplfmt;
*inlr = *on;
/end-free
I have been through some posts and this could be something to do with CCSID. However 819 did not work for me (I always got invalid CCSID error for that field) so tried to set the output field in database file to CCSID 1208. Here is the result -
dataurl324492.png
....5...10...15...20...25...30...35...40...45...50 ...55...60
';??■■;?|■■■■■■■■;??■■■■■■■■?■■■■; ■+■■■■■■■■;?? '
Can you please help me understand what is wrong?
Thank you in advance.
This is the expected result when I do this online -
^FS
^FO505,29
^FB264,5,0,4)y84)y
Regards, Gauri
Comment