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



hi Alan,

On 11/30/2012 4:12 PM, Alan Campin wrote:
OK, but how do you parse the JSON? There are all kinds of choices for
parsing XML including built into the RPG language. Hard for me to believe
that XML has that much overhead.


Parsing (as well as transferring) XML definitely adds some overhead... probably takes 4 times as long as straight parameter passing... but, whether that overhead matters in the greater scheme of things really depends on the application. In most cases, I'd say it doesn't.

I use JSON every day, and prefer it over XML. I use a JSON parser named YAJL, which is open source and written in C. I ported it to IBM i, and have written an RPG front-end for it. It's extremely fast. I evaluated some of the other JSON parsers available for RPG before I did this, but none of them performed well enough for me. YAJL was the fastest I could find.

Some day, when I'm less burned out (sigh), I'll make my IBM i port of YAJL available to the community, and write some articles about it.

Having said that, I'm not sure that JSON is the right option here. One problem with JSON is that the {, }, [, and ] characters that are so heavily used in JSON are "variant" characters in EBCDIC, so they can be a real pain to work with in EBCDIC unless all of your data is always in the same CCSID. In fact, a purist would say that JSON should _always_ be UTF-8.

Now, in a web application, that's generally a non-issue, since UTF-8 is the standard encoding of the web world. But, in a stored procedure call, you'll doubtless be using EBCDIC. I'd probably just go ahead and use XML in that case.

Though, frankily, Alan your idea of passing XML to a stored procedure sounds remarkably like you're reinventing the wheel... since that's pretty much what web services do. However, using a database stored procedure call as a transport is much more limiting (32k parameter limit, threat of a security compromise is higher, static connection is more susceptible to problems on imperfect network connections, etc.)

What is your objection to using web services?

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.