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



Hi Jerry,

Sorry, I was not in the office.

As I said originally the issue is that RPG does not support
multi-dimensional arrays.

The best solution is to use the YAJL procedures to work your way through
the JSON.

Something like ... (Unfortunately the test program I played with was
removed.)

docNode = yajl_stmf_load_tree(%trim(jsonPath) : txt); //Loas the json from
ifs

node = yajl_object_find(docNode : 'error_details');

dow YAJL_ARRAY_LOOP(node : i : outerNode);

dow YAJL_ARRAY_LOOP(outerNode : j : innerNode);

txt = yajl_get_string(innerNode);

But the programmer working on this issue ended up going with below which
is working in production.

Here is the JSON we were having issues with.

{"error_details":[["34515897: meter_off_time 2025-10-06 01:57:06+00:00 is
equal to or before meter_on_time '2025-10-06
02:45:04+00:00'"]],"errored_booking_numbers":["34515897"],"ignored_booking_numbers":[],"saved_booking_numbers":["34527032","34526927","34526855","34521442"],"summary":{"error":1,"ignored_duplicate":0,"saved":4}}

Here is the data structure we ended up going with

dcl-ds SATSSData_rUploadData qualified template inz;
dcl-ds rData likeds(DKT_GeneralReturnData);
dcl-ds summary;
saved zoned(5) inz(*zeros);
ignored zoned(5) inz(*zeros);
ignored_duplicate zoned(5) inz(*zeros);
error zoned(5) inz(*zeros);
end-ds summary;
count_saved_booking_numbers zoned(5) inz(*zeros);
saved_booking_numbers varchar(20) inz('')
dim(C_SATSS_MAXDATA);
count_ignored_booking_numbers zoned(5) inz(*zeros);
ignored_booking_numbers varchar(20) inz('')
dim(C_SATSS_MAXDATA);
count_errored_booking_numbers zoned(5) inz(*zeros);
errored_booking_numbers varchar(20) inz('')
dim(C_SATSS_MAXDATA);
//count_error_details zoned(5) inz(*zeros);
//dcl-ds error_details likeds(SATSSData_ErrorBooking)
// inz(*LIKEDS) dim(C_SATSS_MAXDATA);
end-ds;

Here is the DATA-INTO we used.

Data-into rtnData %Data( %trim(rData.File) :
'doc=file case=convert allowmissing=yes allowextra=yes +
countprefix=count_ trim=all')
%Parser( 'YAJLINTO' );

 

Don Brown

Senior Consultant
 
[1]OneTeam IT Pty Ltd
P: 1300 088 400

Thank you for your support in 2025
Our offices will be closed from COB on Wednesday December 24, reopening
Monday January 5, 2026.
We are providing support via 1300 088 400 and servicedesk@xxxxxxxxxxxxxxxx
during this time.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jerry
Forss
Sent: Wednesday, 17 December 2025 1:30 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: External Returned JSON with double array

I am back into the office and need to get this working.
They are deprecating their old system on Friday! Lots of notice.

Here is what I have. Notice the multi dem array on revenueDetails.
I am ignoring this part for now.

Json

{
"order_number": "Q0355983",
"bill_to_account_number": "52557",
"billto": {
"name": "WALZCRAFT INDUSTRIES INC",
"address1": "2600 HEMSTOCK ST",
"address2": "PO BOX 1748",
"city": "LA CROSSE",
"state_id": "WI",
"zip_code": "54602"
},
"collection_method": "P",
"pieces": 1,
"weight": 292,
"weight_um": "LB",
"customer_name": "WALZCRAFT INDUSTRIES INC",
"bill_distance": 82,
"bill_distance_um": "MI",
"freight_charge": 97,
"otherchargetotal": 32.01,
"total_charge": 129.01,
"rate": 97,
"rate_type": "F",
"rate_unit_desc": "FLAT",
"rate_units": 1,
"total_spots": 1,
"total_cubic_volume": 136080,
"transit_days": 1,
"freightGroupItems": [
{
"description": "Container: Quote-28647-001",
"hazmat": false,
"hazmat_is_residue": false,
"height": 36,
"length": 90,
"width": 42,
"nmfc_class_code": "70",
"spots": 1,
"pieces": 1,
"weight": 292,
"weight_uom_type_code": "LBS"
}
],
"revenueDetails": [
[
{
"name": "Fuel Surc",
"description": "Fuel Surcharge",
"calc_rate": 0.33,
"revenue_amount": 32.01,
"freight_class_code": "70",
"id": 68
},
{
"name": "Minimum B",
"description": "MINIMUM CHARGE",
"calc_rate": 97,
"revenue_amount": 97,
"freight_class_code": "70",
"id": 170
}
]
],
"shipper": {
"name": "WalzCraft",
"address": "2600 Hemstock St",
"city_name": "LA CROSSE",
"state": "WI",
"zip_code": "54603",
"sched_arrive_early": "20251216080000-0600",
"sched_arrive_late": "20251216170000-0600"
},
"consignee": {
"name": "ELIAS CONSTRUCTION LLC",
"address": "1207 FRONTAGE RD NW",
"city_name": "BYRON",
"state": "MN",
"zip_code": "55920",
"sched_arrive_early": "20251217080000-0600",
"sched_arrive_late": "20251217170000-0600"
},
"notice": "Quote is only valid for the customer specified in the quote and
is valid for ten (10) days.\nThe rates may increase if another customer is
invoiced for the shipment.\nFuel surcharges on the final invoice will
reflect the fuel surcharge in place for the customer on the ship date,
regardless of the amount provided in this quote.\nThe final charge may
also change if the shipment’s physical characteristics are not accurately
reflected in the quote; such as being heavier, larger or belonging to a
different freight class than what was provided."
}

My code

// Rate Results From API Call
Dcl-ds RateResponse Qualified;

order_number Char(10);
bill_to_account_number Char(10);
Dcl-ds billto;
name Char(50);
address1 Char(50);
address2 Char(50);
city Char(50);
state_id Char(20);
zip_code Char(10);
End-Ds;

collection_method Char(1);
pieces Packed(3 : 0);
weight Packed(5 : 0);
weight_um Char(3);
customer_name Char(50);
bill_distance Packed(5 : 0);
bill_distance_um Char(3);
freight_charge Packed(7 : 2);
otherchargetotal Packed(7 : 2);
total_charge Packed(7 : 2);
rate Packed(7 : 2);
rate_type Char(10);
rate_unit_desc Char(10);
rate_units Packed(5 : 0);
total_spots Packed(3 : 0);
total_cubic_volume Packed(7 : 0);
transit_days Packed(3 : 0);

End-Ds;

I have a Monitor around this code and it fails with
Message ID . . . . . . : RNX0356
Date sent . . . . . . : 12/16/25 Time sent . . . . . . : 09:19:33

Message . . . . : The document for the DATA-INTO operation does not match
the RPG variable; reason code 5.

There is data in RateResponse

// Parse Response JSON Rates Doc Using YAJL
data-into RateResponse %DATA(ResponseFile
: 'doc=file case=any countprefix=cnt_ allowmissing=yes allowextra=yes')
%PARSER('YAJLINTO');

From debug

EVAL RateResponse
RATERESPONSE.ORDER_NUMBER = 'Q0355983 '
RATERESPONSE.BILL_TO_ACCOUNT_NUMBER = '52557 '
RATERESPONSE.BILLTO.NAME =
'WALZCRAFT INDUSTRIES INC '
RATERESPONSE.BILLTO.ADDRESS1 =
'2600 HEMSTOCK ST '
RATERESPONSE.BILLTO.ADDRESS2 =
'PO BOX 1748 '
RATERESPONSE.BILLTO.CITY =
'LA CROSSE '
RATERESPONSE.BILLTO.STATE_ID = 'WI '
RATERESPONSE.BILLTO.ZIP_CODE = '54602 '
RATERESPONSE.COLLECTION_METHOD = 'P'
RATERESPONSE.PIECES = 001.
RATERESPONSE.WEIGHT = 00292.
RATERESPONSE.WEIGHT_UM = 'LB '
RATERESPONSE.CUSTOMER_NAME =
'WALZCRAFT INDUSTRIES INC '
RATERESPONSE.BILL_DISTANCE = 00082.
RATERESPONSE.BILL_DISTANCE_UM = 'MI '
RATERESPONSE.FREIGHT_CHARGE = 00097.00
RATERESPONSE.OTHERCHARGETOTAL = 00032.01
RATERESPONSE.TOTAL_CHARGE = 00129.01
RATERESPONSE.RATE = 00097.00
RATERESPONSE.RATE_TYPE = 'F '
RATERESPONSE.RATE_UNIT_DESC = 'FLAT '
RATERESPONSE.RATE_UNITS = 00001.
RATERESPONSE.TOTAL_SPOTS = 001.
RATERESPONSE.TOTAL_CUBIC_VOLUME = 0136080.
RATERESPONSE.TRANSIT_DAYS = 001.

First, WHY is it giving me the RNX0356 error? Everything in the
RateResponse is there.

Second, I would like to get the accessorial info from the revenueDetails.
YAJL doesn’t like I How best to handle.

--
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: [2]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
[3]https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

--
Message protected by MailGuard: e-mail anti-virus, anti-spam and content
filtering.
[4]https://www.mailguard.com.au

Click here to report this message as spam:
[5]https://console.mailguard.com.au/ras/2bGRE6LVmg/1BeiHbyytGMbuf9kU8TFKo/0.9

References

Visible links
1. https://www.oneteamit.com.au/
2. https://lists.midrange.com/mailman/listinfo/rpg400-l
3. https://archive.midrange.com/rpg400-l.
4. https://www.mailguard.com.au/
5. https://console.mailguard.com.au/ras/2bGRE6LVmg/1BeiHbyytGMbuf9kU8TFKo/0.9

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.