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



Booth,

I agree with Brad's comment....keep it simple to start...I am not familiar enough with CGIDEV2 and YAJL to give you a code example (I use them, but not regularly) but it is really simple conceptually.  Getting a working example that demonstrates the basics is what you need...

Pete Helgren
www.petesworkshop.com
GIAC Secure Software Programmer-Java
Twitter - Sys_i_Geek IBM_i_Geek

On 8/28/2018 10:37 AM, Bradley Stone wrote:
yajl_writeStdout(): Copy YAJL generator buffer to Apache via
stdout (with headers)

This should be all you need. If you want to debug the JSON it's making,
you can write it out to the IFS as well.

Don't try to make it too difficult.

Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #12 <https://www.bvstools.com/mailtool.html>: Both Text
and HTML email support

On Tue, Aug 28, 2018 at 10:29 AM Pete Helgren <pete@xxxxxxxxxx> wrote:

So, one other idea that would still use CGIDEV2 (I could easily pull it
off with Java...my comfort zone...)

So, you do your magic with Scott's YAJL and either write it to the IFS
or hold the output in memory. I think that CGIDEV2 can read in a file
from the IFS, any text file, your file in JSON format. So, you read
that file in and then output the entire contents with the WrtNoSection
subprocedure. You may want a file that has a minimal header with
something like

/$top
Content-type:application/json
Expires: 0

so that the file is written with the correct content type....seems like
that would be simple and would work.....

If I get a chance I'll whip up a proof of concept...RPG and CGIDEV2
aren't my strong suits but cobbling stuff together is :-)


Pete Helgren
www.petesworkshop.com
GIAC Secure Software Programmer-Java
Twitter - Sys_i_Geek IBM_i_Geek

On 8/27/2018 9:16 PM, Booth Martin wrote:
Thank you Peter. I am already writing a .json file with RPG using
Scott's yajl library. Super simple and works just fine.

My current goal is to go the next step and offer the output as a REST
web service. I would explain it a bit more, but as is evident, I am
confused about the process so anything I might write about it should
be viewed with caution.



On 8/27/2018 4:59 PM, Pete Helgren wrote:
Booth,

Not sure if you are set on a DB2 file outputting JSON and then
writing it out....I haven't played with JSON in that way. But I am
using CGIDEV2 in a SQLRPGLE program and it simply outputs JSON as
part of an HTML template where I iterate through the DB records, and
use updhtmlvar to update each json value in the template and just
write it out. You can see it in action here:
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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: http://amzn.to/2dEadiD


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.