I'm consuming a relatively new web service... just wondering if the error I'm getting is due to my poor coding, or their poor implementation.


Message . . . . : The document for the DATA-INTO operation does not match
the RPG variable; reason code 4.
The exact subfield ..
json.response(1).repgroupretailermanufacturers.accountnumber

UGGHHH...

My DS looks like this...

...more above
num_repgroupretailermanufacturers uns(5) inz(0);
dcl-ds repgroupretailermanufacturers;
accountnumber varchar(10) inz(''); // This is our Customer Number
// minimumorderamount varchar(1) inz('');
// minimumreorderamount varchar(1) inz('');
// shipToAccountnumber varchar(1) inz('');
end-ds;
...more below

dcl-c RPGOPTS const('doc=file case=convert allowextra=yes countprefix=num_');
dcl-c YAJLOPTS const('{ "value_null": "", "document_name": "json"}');

monitor;
Data-Into json %data(inStmf:RPGOPTS) %parser('YAJLINTO':YAJLOPTS);
on-error;
ouErrors = 1;
return;
endmon;

The JSON array causing the error normally looks like this:

"repGroupRetailerManufacturers": {
"accountNumber": "10434741",
"minimumOrderAmount": 250,
"minimumReOrderAmount": 250,
"shipToAccountNumber": null
},

However, this document contains:

"repGroupRetailerManufacturers": null,


Short of having a NUM_ variable in front of EVERY element, is my only option to do allowmissing=yes??
(I can "feel" Jon Paris leaning over my shoulder while I code) LOL



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.