Re: Reading JSON Problem(s)
Posted: Wed Aug 04, 2021 9:36 pm
Ok... made the changes to the field names. Getting another error:
Here is my updated RPG. Note that the first data structure is called allresponse. Should this be something different? I've looked at the spelling of everything else and unless I missed something it all seems to match the JSON file:
Code: Select all
Additional Message Information
Message ID . . . . . . : RNX0356 Severity . . . . . . . : 50
Message type . . . . . : Escape
Date sent . . . . . . : 08/04/21 Time sent . . . . . . : 16:31:42
Message . . . . : The document for the DATA-INTO operation does not match
the RPG variable; reason code 5.
Cause . . . . . : While parsing a document for the DATA-INTO operation, the
parser found that the document does not correspond to RPG variable
"allresponse" and the options do not allow for this. The reason code is 5.
The exact subfield for which the error was detected is
"allresponse.batchclaimresponse(1).claiminfo". The options are "doc=file
case=any". The document name is /eric/4WARD/Claim Submit Response Test.json;
*N indicates that the document is not an external file. The parser is
'YAJL/YAJLINTO'. *N indicates that the parser is a procedure pointer.
Code: Select all
**free
ctl-opt dftactgrp(*no) debug option(*srcstmt:*nodebugio);
ctl-opt bnddir('QC2LE':'YAJL');
dcl-ds allresponse qualified;
status char(20);
message char(60);
interfaceName char(80);
dcl-ds batchClaimResponse dim(150);
businessPartnerCode char(10);
dcl-ds claimInfo;
claimNumber char(20);
trackNumber char(10);
repairingOutlet char(10);
repairOrder# char(6);
serialNumber char(10);
submittalIndicator char(1);
dateTimeProcessed char(23);
claimStatusCode char(3);
claimStatusDescription char(80);
dispositionCode char(10);
dispositionCodeDescription char(80);
rmaStatusCode char(3);
rmaStatusDescription char(80);
approvedDollarAmount char(15);
identifier char(10);
end-ds;
dcl-ds claimProcessMsgInfo dim(300);
lineNumber char(10);
processCode char(4);
processCategoryDescription char(25);
processMessage char(80);
end-ds;
end-ds;
end-ds;
dcl-s jsonpath varchar(150)
inz('/eric/4WARD/Claim Submit Response Test.json');
data-into allresponse %data(jsonpath:
'doc=file case=any')
%Parser('YAJL/YAJLINTO');
*inlr = *on;