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



OK - but there is no node called "list" Booth - why did you expect to be able to load it?

Looks like you need something like this:


c = 0; // Tell YAJL to start at beginning

Dow YAJL_ARRAY_LOOP( docNode: c: itemNode ); // Get node for item

custNode = YAJL_OBJECT_FIND( itemNode: 'Cust#' ); // Get Cost# from itemNode
cust# = YAJL_GET_NUMBER( custNode );

lastNode = YAJL_OBJECT_FIND( customerNode: 'Last' );
last = YAJL_GET_STRING( lastNode );


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Aug 25, 2017, at 8:58 PM, Booth Martin <booth@xxxxxxxxxxxx> wrote:

Here is the entire c-specs; in an effort to isolate the problem I created this stripped-out version.

// Load JSON data from the IFS file using YAJL
docNode = yajl_stmf_load_tree('/home/bmartin/Louie.json': errMsg );
if errMsg = ' ';
node = YAJL_object_find(docNode: 'success');
result.success = YAJL_is_true(node);
node = YAJL_object_find(docNode: 'errmsg');
result.errmsg = YAJL_get_string(node);
list = YAJL_object_find(docNode: 'list');
dsply %subst(result.list(1): 1: 50);
else;
dsply 'File not found';
endif;
*inlr = *on;

-------------------------
Here is the first record in Louie.json:
[
{
"Cust#": "839283",
"Last": "Jones",
"Initials": "B D",
"Address": "21B NW 135 St",
"City": "Clay",
"Cust State": "NY",
"Zip Code": "13041",
"Credit Limit": "505",
"Charge Code": "1",
"Balance Due": "101.00",
"Credit Due": "400.00",
"Create Date": "20130316"
},
...
I expected a value in list or in result.list.
---------------------
Oh, and here is wrklnk:
Directory . . . . : /home/bmartin

Type options, press Enter.
2=Edit 3=Copy 4=Remove 5=Display 7=Rename
11=Change current directory ...

Opt Object link Type Attribute
DBKTran DIR
Logger.log STMF
Louie.json STMF


On 8/25/2017 6:54 PM, Jon Paris wrote:
Booth - It appears you have a valid node from opening the doc but since I can't find a copy in the thread of your actual JSON I can't make much of a suggestion as to what to look for next.

Can you give us an extract of the JSON and also a repeat of the first few lines of RPG after the tree build.


Jon Paris

www.partner400.com
www.SystemiDeveloper.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.

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