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



You do not need all the field but you have to set an option to control it.

data-into Inputvalues %DATA(json: 'case=any allowmissing=yes allowextra=yes')
%PARSER( 'YAJLINTO');


John Slanina

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> On Behalf Of Steve Jones
Sent: Tuesday, May 29, 2018 9:00 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: data-into

So the DS does need to have every field, even if they will not be used in the pgm?

On Tue, May 29, 2018 at 8:52 AM Mark Murphy <jmarkmurphy@xxxxxxxxx> wrote:

looks like there are quite a few fields missing from your data
structure. The first missing field is customer_id in customers. Then
shipping_address, and in the address data structures, country is
missing from the DS, and finally everything after email is missing from the DS.

On Tue, May 29, 2018 at 8:42 AM, Steve Jones <sjones@xxxxxxxxxxxxxxx>
wrote:

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!!
--
Steve Jones
H-P Products, Inc
330-871-2054

--
NOTE: The information in this email is confidential and may be
legally privileged. If you are not the intended recipient, you must
not read, use or disseminate the information; please advise the
sender immediately by reply email and delete this message and any
attachments without retaining a copy. Although this email and any
attachments are believed to be free of any virus or other defect
that may affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by H-P Products,
Inc. for any loss or damage arising in any way from its use.
--
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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
https://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
--
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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
https://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



--
Steve Jones
H-P Products, Inc
330-871-2054

--
NOTE:  The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information; please advise the sender immediately by reply email and delete this message and any attachments without retaining a copy.  Although this email and any attachments are believed to be free of any virus or other defect that may affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by H-P Products, Inc. for any loss or damage arising in any way from its use.
--
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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://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.