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



After seeing Scott Klements session at Powerup18 on using Json & the new
data into, I wanted to start using it.

I am getting the error
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
"result"
and the options do not allow for this. The reason code is 5. The
exact
subfield for which the error was detected is "result.customers(1)".
The
options are "doc=file case=any countprefix=num_". The document name
is
/paytrace/889_output.json; *N indicates that the document is not an
externa
file. The parser is 'YAJLINTO'. *N indicates that the parser is a
procedure
pointer.

So that leads me to believe my DS does not match, but I am not seeing where
it is not matching, unless you need to define fields you are not even going
to use in the pgm.

Here is my DS:
Dcl-ds result qualified;
success ind;
response_code int(3);
status_message varchar(500);
num_customers int(10);

Dcl-ds customers dim(10);
Dcl-ds credit_card;
masked_number char(16);
expiration_month int(2);
expiration_year int(2);
End-ds;
Dcl-ds billing_address;
name char(40);
street_address char(40);
city char(40);
state char(2);
zip char(10);
End-ds;
email char(70);
End-ds;

End-ds;

Here is the raw json I am trying to read from the IFS:
{"success":true,"response_code":1,"status_message":"Your request has been
successfully completed.","customers":[{"customer_id":"100-1
","credit_card":{"masked_number":"************1111","expiration_month":12,"expiration_year":20},"shipping_address":{"name":"","street_address":"","street_address2":"","city":"","county":"","state":"","zip":"","country":"US"},"billing_address":{"name":"Transfer
Order","street_address":"Internal Use
Only","street_address2":"","city":"Anywhere","state":"OH","zip":"44721","country":"US"},"email":"
testing@xxxxxxxxxx","phone":"","fax":"","created":{"at":"5/25/2018 7:26:13
AM","by":"demo123","from_ip":"x.x.x.x"},"discretionary_data":{"Site
IDs":"","Company Name":"","Location":""}}]}

The data-into is:
data-into result %Data(outFile
:'doc=file case=any countprefix=num_')
%PARSER('YAJLINTO');

Anyone see where I am missing what is causing the error?

Thanks!!

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.