× 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.



Hello Filip,

Its not very clear whether you are referring to DATA-GEN or DATA-INTO.   You say "DATA-GEN parser" in the first sentence of your message, but DATA-GEN doesn't use a parser, it uses a generator.  You proceed to refer to YAJLINTO which is the parser for DATA-INTO.   So I'm not certain which one you are using?

Unfortunately, when IBM created these two opcodes (DATA-INTO and DATA-GEN) they did not incorporate support for null indicators. (It might be a good idea to put in a request for one, because I've been asked about this a lot.)

YAJLINTO (with DATA-INTO) has a way to work around this.  It will place the special string value "*NULL" into a character string. You can change this to a different string/number by specifying the "value_null" option to the %PARSER built-in function.

YAJLDTAGEN (with DATA-GEN) does not have any option for null. Since RPG won't pass null, there really is no way to indicate that a value should be null with DATA-GEN.  This is not normally a problem, as in JSON a field that's set to null is usually the same as not specifying the field at all.  So you can simply use a 'countprefix' to completely omit the field from the output.  But, if you have an unusual situation where it is required to pass the field with null instead of omitting it, then you won't be able to do so with DATA-GEN.   You can do it with the YAJL subprocedures instead of DATA-GEN, however.

Good Luck


On 4/10/2020 4:51 AM, Filip Drzewiecki via RPG400-L wrote:
Hi Scott,

I've started testing Scott data-gen parser from YAJL and I have one problem. I can't see a way to handle nulls from the data structure when I use null indicators.
When I pass data-structure with null indicator *on, in JSON string it is visible as either blank or 0 depends on the variable type.
I can see that there is one procedure do_null in YAJLINTO and some procedures (C scares me) for null handling in YAJL_H but I'm not sure what they do exactly...

Filip

Filip Drzewiecki
RPG Developer

e-mail: fdrzewiecki@xxxxxxxxxxxxxxxxx<mailto:fdrzewiecki@xxxxxxxxxxxxxxxxx>
kom.: +48 608 438 591
[cid:image001.png@01D60F2E.4F8421A0]
Objectivity Sp. z o.o.
ul. Strzegomska 142a, 54-429 Wroclaw, Poland
e-mail: info@xxxxxxxxxxxxxxxxx<mailto:info@xxxxxxxxxxxxxxxxx>
[cid:image002.png@01D60F2E.4F8421A0]<http://www.objectivity.co.uk/>
[cid:image003.png@01D60F2E.4F8421A0]
Objectivity Sp. z o.o. is a 100% subsidiary of Objectivity Ltd.
Statutory information: NIP: 8942941304 | REGON: 020745428 | Sad Rejonowy dla Wroclawia-Fabrycznej | VI Wydzial Gospodarczy Krajowego Rejestru Sadowego | KRS: 0000303475 | Kapital zakladowy: 500 000 PLN

This email and the information it contains are confidential. If you have received this email in error please notify the sender immediately.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.