× 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 can open the JSON in FireFox and Notepad++ without any errors... so I assume it's ok.

I left a counter on the important stuff... My program simply populates database files - all of the logic takes place in the subsequent program that processes the DB files.
So (for now), I have added allowmissing=yes. I'm not sure why this would be such a "terrible" solution here.

Greg

Here is the particular JSON

{
"creationTime": "01-06-2021 19:24:34.698+0000",
"response": [
{
"acceptBackOrder": 1,
"attachDocuments": null,
"billToAddress1": "2407 Steel Street",
"billToAddress2": null,
"billToCity": "Houston",
"billToCountry": null,
"billToName": "Kuhl-Linscomb Upper Kirby Inc.",
"billToState": "TX",
"billToZip": "77098",
"cancelDate": "2021-03-15",
"estimatedHandlingCost": null,
"estimatedShippingCost": null,
"externalID": "KathleenTEND010520211801151",
"externalID2": null,
"fOBLocation": null,
"manufacturerCommissionPercent": null,
"manufacturerDateSent": 1609950940157,
"manufacturerMethodSent": null,
"manufacturerOrderNumber": "766450938",
"manufacturerOrderStatus": "OPEN",
"newAccountToManufacturer": 0,
"notes": null,
"oOTCommissionReason": null,
"orderCode": "R",
"orderDate": "2021-01-05",
"orderDiscount": 0,
"orderTotal": 1072,
"orderType": "Line Item",
"paymentTerm": "NET60",
"paymentToken": null,
"pONumber": "86749",
"repGroupOrderStatus": "TRANSMITTED",
"requestDate": "2021-01-05",
"retailerDateSent": 1609826400000,
"retailerMethodSent": null,
"sentTrackingNumber": null,
"shipDate": null,
"shippingMethod": "FFA",
"shippingNotes": null,
"shipToAddress1": "2407 Steel Street",
"shipToAddress2": null,
"shipToCity": "Houston",
"shipToCountry": null,
"shipToName": "Kuhl-Linscomb Upper Kirby Inc.",
"shipToState": "TX",
"shipToZip": "77098 ",
"specialInstructions": "$500 Order: FFA",
"tags": null,
"manufacturerID": "M25405",
"salespersonOrderWriterID": "S1037",
"salespersonAssignedID": "S1037",
"orderDetails": [
{
"color": null,
"description": "Noah's Wooden Ark",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8306",
"itemStatus": null,
"listPrice": null,
"name": "Noah's Wooden Ark",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 1,
"size": null,
"style": null,
"unitPrice": 45,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Smoothie Maker",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8224",
"itemStatus": null,
"listPrice": null,
"name": "Smoothie Maker",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 8,
"size": null,
"style": null,
"unitPrice": 23,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Toaster & Egg Set",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8221",
"itemStatus": null,
"listPrice": null,
"name": "Toaster & Egg Set",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 9,
"size": null,
"style": null,
"unitPrice": 20,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Medical Set",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8111",
"itemStatus": null,
"listPrice": null,
"name": "Medical Set",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 10,
"size": null,
"style": null,
"unitPrice": 22.5,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Peacock Colours",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "tl8338",
"itemStatus": null,
"listPrice": null,
"name": "Peacock Colours",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 11,
"size": null,
"style": null,
"unitPrice": 12.5,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Noah's Shape Sorter Ark",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8305",
"itemStatus": null,
"listPrice": null,
"name": "Noah's Shape Sorter Ark",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 2,
"size": null,
"style": null,
"unitPrice": 25,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Baby Barn Set",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8301",
"itemStatus": null,
"listPrice": null,
"name": "Baby Barn Set",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 3,
"size": null,
"style": null,
"unitPrice": 35,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Rainbow Birthday Cake",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8282",
"itemStatus": null,
"listPrice": null,
"name": "Rainbow Birthday Cake",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 4,
"size": null,
"style": null,
"unitPrice": 10,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Shopping Grocery Bag",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8273",
"itemStatus": null,
"listPrice": null,
"name": "Shopping Grocery Bag",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 5,
"size": null,
"style": null,
"unitPrice": 17.5,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Ice Cream Cart",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8236",
"itemStatus": null,
"listPrice": null,
"name": "Ice Cream Cart",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 6,
"size": null,
"style": null,
"unitPrice": 32.5,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
},
{
"color": null,
"description": "Tea Tray Set",
"itemDiscount": 0,
"itemID": null,
"itemNumber": "TL8233",
"itemStatus": null,
"listPrice": null,
"name": "Tea Tray Set",
"notes": null,
"quantity": 4,
"retailerItemNumber": null,
"sequenceID": 7,
"size": null,
"style": null,
"unitPrice": 25,
"unitQty": 1,
"priceCode": null,
"upc": null,
"itemSCSID": null,
"bulkEditError": null,
"unitPriceModified": false
}
],
"orderPayments": [],
"orderPaymentTokens": [],
"orderPromotions": [],
"repGroup": {
"recordID": "R36",
"address1": "2050 N. Stemmons Frwy Ste 8654",
"address2": null,
"city": "Dallas",
"country": "USA",
"email": "teri@xxxxxxxxxxxxxxxxxxxxxxx",
"fax": "9726906127",
"faxCountryCode": null,
"faxExtension": null,
"name": "Young Associates",
"phone": "4694419471",
"phoneCountryCode": null,
"phoneExtension": null,
"state": "TX",
"website": "www.youngassociatestoys.com",
"zip": "75207",
"latitude": null,
"longitude": null
},
"retailerID": "B159594",
"retailerCarrierAccount": null,
"retailerContact": {
"cell": null,
"cellCountryCode": null,
"email": "pam@xxxxxxxxxxxxxxxxx",
"fax": null,
"faxCountryCode": null,
"faxExtension": null,
"firstName": "Pam",
"lastName": "Kuhl-Linscomb",
"middleName": null,
"phone": "7135204000",
"phoneCountryCode": null,
"phoneExtension": null,
"isPrimary": null,
"title": null
},
"retailerShipToID": 47883,
"salesperson1": {
"name": "Kathleen Schroeder"
},
"salesperson2": {
"name": "Kathleen Schroeder"
},
"repGroupRetailerManufacturers": null,
"recordID": "1f535eaa-df1f-4c35-a45b-9a67ca357e2e"
}
],
"success": true
}

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Wednesday, January 06, 2021 3:59 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: DATA-INTO Error RNX0356 (json)

Off the top of my head the only thing I can think of is that datasubf _might_ handle it. It is a similar situation to and XML element with both data and attributes. You'd still need a count or allowmissing.

I was going to try it for you but you haven't given enough of the JSON or me to be able to produce a valid JSON file that demonstrates your code.

You have validated the JSON right?


Jon

On Jan 6, 2021, at 3:00 PM, Greg Wilburn <gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

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


--
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@xxxxxxxxxxxxxxxxxxxx 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.