Hi Booth, maybe I don't understand completely the problem so, if I
misunderstood your request, I apologize in advance.

If the goal is having an RPG program published as a REST web service the
easiest way is IWS. IWS provides SOAP and/or REST with swagger. Also there
is a nice future to ease the fact that RPG has fixed rows (Array), in fact
if you define a program like:

Dcl-ds Input qualified template inz;
State char(2);
End-ds;
Dcl-Ds Output qualified template inz;
CityNames_LENGTH int(10);
CityNames char(50) dim(999);
End-ds;

Dcl-pi *n;
Request likeds(input);
Response likeds(Output)
End-pi;

and publish with IWS. Your program will receive a State e will return
CityNames_LENGTH with the city's number.

That's it.

The other side of the medal (consuming the web services in a web env) can
be much much more interesting.

HTH

--
Marco Facchinetti

Mr S.r.l.

Tel. 035 962885
Cel. 393 9620498

Skype: facchinettimarco


Il giorno mar 28 ago 2018 alle ore 04:16 Booth Martin <booth@xxxxxxxxxxxx>
ha scritto:

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

This thread ...

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