Ever have one of those times you feel like you are losing your mind. I'm having one.
I'm a newby with YAJL and probably doing something obviously wrong but CANNOT FIND MY PROBLEM!!!
Last week I loaded up YAJL from Scott Klement's site, thanks again Scott!
I coded a program to to yajl_stmf_load_tree and everything was perfect, the example programs were a GREAT help!!!!
For some reason it has stopped working and after 2 days of beating my head against the wall I thought I'd seek wisdom from higher powers.
It appears my tree is not loading (all elements are blanks) and I cannot figure out why.
Below is my situation.
Thank you for any help you can provide!!!!!!!!
JSON FILE
{ "partNumbers":[ "103-3229", "103-3233-S", "103-6381-S", "103-6382-S", "103-6383-S", "103-6384-S", "103-6422", "109-0343", "109-2549-S", "119-4702", "120-5236", "106-2247-03", "131-3938-03", "1-513875", "1-513973", "1-523510", "1-523512", "103-0301", "103-0301-S", "103-0301-S_MPK3" ] }
RPG PGM
H DFTACTGRP(*NO) ACTGRP('KLEMENT') OPTION(*SRCSTMT)
H BNDDIR('YAJL')
//************************************************** ************
// FUNCTION: Decode Shop Local Inventory Avail JSON
//************************************************** *************
// MAINTENANCE HISTORY
//************************************************** *************
// GAB 04/20/2022 Created.
//************************************************** *************
// Relies on YAJL library.
// Takes input from Shop Local and creates database for HHR500
// to create response inventory available response.
// shoplocal/hhr500IN.json
//************************************************** *************
FHHR500IN O A E DISK
/INCLUDE yajl_h
D list_t ds qualified
D template
D item 20a
D result ds qualified
D success 1n
D errMsg 500a varying
D list likeds(list_t) dim(999)
D docNode s like(yajl_val)
D list s like(yajl_val)
D node s like(yajl_val)
D val s like(yajl_val)
D i s 10i 0
D lastElem s 10i 0
D dateUSA s 10a
D errMsg s 500a varying inz('')
/free
docNode = yajl_stmf_load_tree( '/shoplocal/hhr500in.json' : errMsg );
if errMsg <> '';
errMsg = errMsg;
endif;
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: 'partNumbers');
i = 0;
dow YAJL_ARRAY_LOOP( list: i: node );
lastElem = i;
val = YAJL_object_find(node: 'list');
result.list(i).item = yajl_get_string(val);
hhitem = result.list(i).item;
write hhr500inr;
enddo;
yajl_tree_free(docNode);
*inlr = *on;
I'm a newby with YAJL and probably doing something obviously wrong but CANNOT FIND MY PROBLEM!!!
Last week I loaded up YAJL from Scott Klement's site, thanks again Scott!
I coded a program to to yajl_stmf_load_tree and everything was perfect, the example programs were a GREAT help!!!!
For some reason it has stopped working and after 2 days of beating my head against the wall I thought I'd seek wisdom from higher powers.
It appears my tree is not loading (all elements are blanks) and I cannot figure out why.
Below is my situation.
Thank you for any help you can provide!!!!!!!!
JSON FILE
{ "partNumbers":[ "103-3229", "103-3233-S", "103-6381-S", "103-6382-S", "103-6383-S", "103-6384-S", "103-6422", "109-0343", "109-2549-S", "119-4702", "120-5236", "106-2247-03", "131-3938-03", "1-513875", "1-513973", "1-523510", "1-523512", "103-0301", "103-0301-S", "103-0301-S_MPK3" ] }
RPG PGM
H DFTACTGRP(*NO) ACTGRP('KLEMENT') OPTION(*SRCSTMT)
H BNDDIR('YAJL')
//************************************************** ************
// FUNCTION: Decode Shop Local Inventory Avail JSON
//************************************************** *************
// MAINTENANCE HISTORY
//************************************************** *************
// GAB 04/20/2022 Created.
//************************************************** *************
// Relies on YAJL library.
// Takes input from Shop Local and creates database for HHR500
// to create response inventory available response.
// shoplocal/hhr500IN.json
//************************************************** *************
FHHR500IN O A E DISK
/INCLUDE yajl_h
D list_t ds qualified
D template
D item 20a
D result ds qualified
D success 1n
D errMsg 500a varying
D list likeds(list_t) dim(999)
D docNode s like(yajl_val)
D list s like(yajl_val)
D node s like(yajl_val)
D val s like(yajl_val)
D i s 10i 0
D lastElem s 10i 0
D dateUSA s 10a
D errMsg s 500a varying inz('')
/free
docNode = yajl_stmf_load_tree( '/shoplocal/hhr500in.json' : errMsg );
if errMsg <> '';
errMsg = errMsg;
endif;
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: 'partNumbers');
i = 0;
dow YAJL_ARRAY_LOOP( list: i: node );
lastElem = i;
val = YAJL_object_find(node: 'list');
result.list(i).item = yajl_get_string(val);
hhitem = result.list(i).item;
write hhr500inr;
enddo;
yajl_tree_free(docNode);
*inlr = *on;
Comment