I did not follow the complete thread,
but ... if he only wants to read data returned from a webservice, why not
just using embedded SQL?
Something like this:
DCL-S JSONVar SQLType(CLOB: 16000000);
DCL-S Text Char(50);
//--------------------------------------------------------------------------
-------------------
Exec SQL
Set :JSONVar = SysTools.httpgetCLOB('
http://YourURL', '');
Text = JSONVar_Data;
Dsply Text;
*InLR = *On;
JSONVar is converted by the SQL Precompiler into a data Structure with 2
Subfields
JSONVAR_LEN as UNS(10) representing the data length
JSCONVAR_DATA as Char(specified CLOB Length) which includes the data
As soon as the data is read into a variable it can be used in composition
with the XML functions or YAJL like any other variable.
BTW Embedded SQL also allows data to be directly read from the IFS.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
?Train people well enough so they can leave, treat them well enough so they
don't want to.? (Richard Branson)
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Joe Pluta
Sent: Montag, 21. August 2017 06:09
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: RPG, retrieving JSON data from a web service
Just a WAG, Booth, but might there be trailing blanks in the file name?
I think I've been bitten by that in the past. As I recall (vaguely) I
managed to create a file that was JOE.TXTbbbb where the b's were blanks,
and I couldn't open it as JOE.TXT.
I am failing to understand something.
* I am using Scott Klement's YAJL library for the iSeries.
* Using FileZilla I FTP'd Louie.json to /home/Martin.
* Using WRKLNK I confirmed that Louie.json is there and there are
valid records in the file.
* I tried:
o docNode = yajl_stmf_load_tree(/home/Martin/Louie.json : errMsg
); and
o docNode = yajl_stmf_load_tree( 'home/Martin/Louie.json' :
errMsg );
* with and without apostrophes, and
* ERRMSG said "stat /home/Martin/Louis.json: No such path or directory."
On 8/19/2017 9:59 PM, Bradley Stone wrote:
You'll need HTTPAPI or GETURI (or similar) to make the request, then
YAJL can process the response very nicely.
You make the request, save the response to the IFS and process like
normal.
Bradley V. Stone
www.bvstools.com
--
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:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://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.