× 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 should have included this:

I'm using
Data-Into json %data(response:RPGOPTS) %parser('YAJLINTO':YAJLOPTS);

Where:

dcl-c RPGOPTS const('case=convert allowextra=yes countprefix=num_ allowmissing=yes');

dcl-c YAJLOPTS const ('{"document_name": "json", "value_null": "", +
"number_prefix": "YAJL_" }');

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Greg Wilburn
Sent: Wednesday, September 8, 2021 5:20 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: JSON DS in service program

I have a service pgm and procedure with a DS defined for a JSON response from an API.

The JSON DS is defined in the d-specs of the service program (not in the procedure).

Even though I have INZ keyword on the JSON DS, it still contains data from the previous call. What is the right way to handle this?

1. Clear JSON in calc specs?
2. Move the DS inside the procedure?

This is defined as a global variable in the module source (above the procedures). I'm thinking this only gets initialized the first time a calling PGM calls the procedure. But I'm not sure how to best fix this.

json(1).delivery_line_2 is the actual data field where I'm able to see it not initialized on subsequent calls

dcl-ds json qualified dim(3) inz;
input_id varchar(36);
input_index int(5) inz(0);
candidate_index int(5) inz(0);
delivery_line_1 varchar(50) inz('');
delivery_line_2 varchar(50) inz('');
last_line varchar(64) inz(''); // City, State & Zip combined
delivery_point_barcode varchar(12) inz(''); // POSTNET barcode
dcl-ds components;
primary_number varchar(10) inz(''); // House, P.O. or Building Nbr

[Logo]<https://www.totalbizfulfillment.com/> Greg Wilburn
Director of IT
301.895.3792 ext. 1231
301.895.3895 direct
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx<mailto:gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>
1 Corporate Dr
Grantsville, MD 21536
www.totalbizfulfillment.com<http://www.totalbizfulfillment.com>
--
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 ...

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.