So, one other idea that would still use CGIDEV2 (I could easily pull it off with 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

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
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:

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


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

This mailing list archive is Copyright 1997-2020 by 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].