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



I agree, Scott. I left a lot to the imagination on that. I'd like to 'skip' right to the Invoice element using path= if possible.


Code...

dcl-ds Invoice qualified dim(20);
CreatedTimestamp timestamp;
InvoiceId varchar(50);
FulfillmentDate timestamp;
SellingLocationId varchar(50);
UpdatedBy varchar(50);
AmountProcessed packed(10:2);
TotalCharges packed(10:2);
InvoiceSubTotal packed(10:2);
ParentOrderId varchar(50);
TaxExemptId varchar(50);
End-ds;

dcl-c RPGOPTS
const('path=data doc=file case=any countprefix=num_ allowextra=yes allowmissing=yes');

dcl-c YAJLOPTS const('{"value_null":"0", "number_prefix":"num_" }');

Clear Invoice;
data-into Invoice %DATA( ifsPathname : RPGOPTS) %PARSER( 'YAJLINTO' : YAJLOPTS);


Trimmed down document...
{
"success": true,
"header": null,
"data": {
"Messages": null,
"PostVoidReason": null,
"SuspendedOrderId": null,
"Invoice": [
{
"CreatedTimestamp": "2019-12-04T22:30:32.766",
"InvoiceId": "36407544440622146349179",
"FulfillmentDate": null,
"SellingLocationId": "0001",
"UpdatedBy": "admin@xxxxxxx",
"AmountProcessed": -89.25,
"TotalCharges": 0.00,
"InvoiceSubTotal": -85.00,
"ParentOrderId": "011123190031001020504",
"TaxExemptId": null
},
{
"CreatedTimestamp": "2019-12-04T22:30:32.766",
"InvoiceId": "36407544440622146349180",
"FulfillmentDate": null,
"SellingLocationId": "0001",
"UpdatedBy": "admin@xxxxxxx",
"AmountProcessed": -89.25,
"TotalCharges": 0.00,
"InvoiceSubTotal": -85.00,
"ParentOrderId": "011123190031001020504",
"TaxExemptId": null
}
],
"TotalTaxes": -4.25,
"BalanceDue": 0.00,
"PK": "5754986290376591116"
},
"requestUri": null,
"statusCode": "OK"
}

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Scott Klement
Sent: Monday, March 9, 2020 2:16 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Using DATA INTO for JSON, path=, YAJLINTO as parser

Hi Stephen,

The example you provided isn't very useful because all it tells us is the name of your variable (RPGOPTS) that you've set the path in... it doesn't tell us what is in that variable.

Please provide:

1) The RPGOPTS variable contents

2) The YAJLOPTS variable contents

3) The document itself so we can see what the elements look like.

Thanks!

-SK


On 3/9/2020 2:11 PM, Stephen Piland wrote:
Has anyone used path= option to have the parser start a level or 2 deep like in IBM link below? Specifically using YAJLINTO as the parser. I am getting an error like it couldn't find the element I specify for path= but I could be messing something up.

Example...
Data-into Invoice %DATA( ifsPathname : RPGOPTS) %PARSER('YAJLINTO':
YAJLOPTS);

Link...
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzasd/patharr
xmp.htm
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
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: https://amazon.midrange.com

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.