× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Boy.. This really sucks. I was able to use Scott's super helpful utility YAJLGEN that reads thru the JSON and creates the entire RPG source code to decode that JSON. All of the DCL-DS, etc that go many levels deep with the DATA INTO code too. It works great. Then you compile and go to try and use it, and because of this limitation imposed (or miss) by IBM, once it hits the 1st element's value that is NULL, you are dead in the water. I would have been able to save a week of work, but alas...


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Scott Klement
Sent: Wednesday, February 12, 2020 5:01 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: JSON, DATA-GEN, YAJLDTAGEN, and Null

Hi Stephen,

Currently, it's not possible to generate a null value.  DATA-INTO and DATA-GEN do not support null indicators (NULLIND/%NULLIND), so there's no way to pass a null value from RPG to the DATA-GEN generator program.

Sorry.

-SK


On 2/12/2020 4:32 PM, Stephen Piland wrote:
I'm attempting to generate a JSON using DATA-GEN opcode and YAJLs YAJLDTAGEN. It is working great and I'm liking it a lot. I haven't been able to figure out how to set a value to NULL ("LocationId":null).

In the mainline, I'm setting the null indicator on the field in the DS (%nullind(jsonDoc.data(x).LocationId) when necessary. I do have the nullind on the field in the data structure that I indicate in DATA-GEN and thought that might do it (see below). Any thoughts?

I'll debug YAJLDTAGEN next.

dcl-ds jsonDoc qualified;
num_data int(10) inz(0);
dcl-ds data dim(100);
LocationId varchar(4) inz(' ') nullind;
ItemId varchar(12) inz(' ');
Price packed(9:3) inz(0);
End-ds;
End-ds;

--
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@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.