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:

http://opensource4i.com/mobile/cgi_adhstm.pgm?action=getList

Again, it is using more RPG plumbing through the use of CGIDEV2 templates but it works...only needs Apache (HTTP server on i) configured to invoke the CGI pgm and a way to get it routed from the Internet (all straightforward).  I'll post the code on Github if you are interested....

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

On 8/27/2018 3:35 PM, Booth Martin wrote:
You are correct, Scott.  I am confused. And still am confused.

My goal is to provide a very simple web service.  The example I am learning with is a DB2 file of 10 to 20 records, each with a state and a city field.  A green screen program maintains the file.  The additional, new piece that I am trying to make work is an Intranet web service that offers that data, in a JSON format, to anyone who asks for it.

My presumption was that there would be an SQLRPGLE program, that when asked, would read the DB2 file and provide a .json data stream that a javascript file could GET and process as the web folks chose, for their needs.

This DB2-to-web page task already works if I write a .json file to the IFS and deal with it as an IFS HTTP website.  So, I know the general process works.  The hang-up for me is the web service piece.

I shall read the slide show presentation one more time.

Your initial premise really is correct; I am confused.  By the way, in case I forget, I really appreciate all the stuff you have offered and all that I have learned from you.  Thank you Scott.


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-2019 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].