Scott
It is working using Data-Into YAJL for a base64 ZPL file, which is only 3760 long.
// Label Response From API Call
Dcl-ds LabelResponse Qualified;
success Ind;
warning Ind;
cnt_messages Int(5);
ApiReference1 VarChar(100);
ApiReference2 VarChar(100);
ApiReference3 VarChar(100);
ApiReference4 VarChar(100);
messages VarChar(100) Dim(10);
labeltype Char(10);
base64data VarChar(4096) CCSID(1208);
End-Ds;
// ----------------------------------------------------------------------------------
// Local Parameters
// ----------------------------------------------------------------------------------
Dcl-S DecodedLabelBinary SQLType(VARBINARY:4096);
Dcl-S DecodedLabel VarChar(4096) CCSID(1208);
// Parse Response JSON Label Doc Using YAJL
data-into LabelResponse %DATA(ResponseFile
: 'doc=file case=any countprefix=cnt_ allowmissing=yes allowextra=yes')
%PARSER('YAJLINTO');
// Decode
Clear DecodedLabelBinary;
Exec SQL Values QSYS2.BASE64_DECODE(:Labelresponse.base64data) Into :DecodedLabelBinary;
If DecodedLabelBinary <> *Blanks;
DecodedLabel = DecodedLabelBinary;
EndIf;
New problem is a json that contains a base64 PDF that is over 153,000 long.
Trying different data types like SQLType(BLOB : 200000)
I am thinking need to use SQL to consume the json because of the data size.
This is from the debug using Data-Into.
EODREPORTRESPONSE.SUMMARYPDFB64_LEN = 1077952576
EODREPORTRESPONSE.SUMMARYPDFB64 =
....5...10...15...20...25...30...35...40...45...50...55...60
1 ' '
61 ' '
121 ' '
181 ' '
I am a complete novice (some embedded SQL) so figuring out how to SQL to consume the json is my struggle.
I WANT/NEED to learn this. Just trying to figure out what I need to learn.
I will figure this out.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Scott Klement
Sent: Wednesday, January 24, 2024 1:54 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: External RE: Base64Decode
Jerry,
You told us last week you had it working. Can you explain what you are currently struggling with? As far as I can tell, the only way I could answer this post, as posted, would be to write an entire program that does what you describe, and hope it's close enough to what you need. That seems like asking quite a bit.
More specifics, more details, show us the code you've tried, explain why it's not working, etc. This would help a lot.
-SK
On 1/24/2024 6:35 AM, (WalzCraft) Jerry Forss wrote:
Does anyone have an example of getting a base64 BLOB element, over 153,000, from a json using SQL?
Once I have the field I can decode it.
Just not figuring out the secret decoder structure to use.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Subject to Change Notice:
WalzCraft reserves the right to improve designs, and to change specifications without notice.
Confidentiality Notice:
This message and any attachments may contain confidential and privileged information that is protected by law. The information contained herein is transmitted for the sole use of the intended recipient(s) and should "only" pertain to "WalzCraft" company matters. If you are not the intended recipient or designated agent of the recipient of such information, you are hereby notified that any use, dissemination, copying or retention of this email or the information contained herein is strictly prohibited and may subject you to penalties under federal and/or state law. If you received this email in error, please notify the sender immediately and permanently delete this email. Thank You
WalzCraft PO Box 1748 La Crosse, WI, 54602-1748
www.walzcraft.com<
http://www.walzcraft.com> Phone: 1-800-237-1326
As an Amazon Associate we earn from qualifying purchases.