|
I guess my concern is that the programmer would not know that the conversion had occurred. If it is an optional feature so that you know it is happening then that is not a problem.--
For that matter is there any reason why DATA-INTO itself could not be changed to accommodate float values? It converts to zoned or packed as required. It could as easily detect the float and convert it just as a conventional EVAL would.
Jon P.
On Sep 18, 2023, at 5:35 PM, Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote:
IMHO, it's more elegant for YAJLINTO to handle this, rather than make RPGers work with floating point... float can have some non-obvious side effects if you aren't used to it.
On 9/18/23 4:02 PM, Jon Paris wrote:
Did my post not make it through Jerry? DATA-INTO can handle it as-is. Just define the fields as float.--
Jon P.
On Sep 18, 2023, at 4:31 PM, (WalzCraft) Jerry Forss <JForss@xxxxxxxxxxxxx> wrote:
Has anyone told you how awesome you are today?
Well, you are!!
Pretty, pretty please!
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Scott Klement
Sent: Monday, September 18, 2023 3:27 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: External DATA-INTO not matching variable
Well... that's a PITA.
If you asked me really nicely, maybe I'd be willing to add logic into YAJLINTO that detected the situation and converted the number before passing it onwards to DATA-INTO.
:-)
On 9/18/23 9:47 AM, (WalzCraft) Jerry Forss wrote:
Tried it. No change. Ug!!
All "support" is in India and only during the day there. All responses I get from them are around 3am here.
Request
{
"from_country": "US",
"from_zip": "54603",
"from_state": "WI",
"from_city": "La Crosse",
"from_street": "2600 Hemstock St",
"to_country": "US",
"to_zip": "53532-9139",
"to_state": "WI",
"to_city": "DEFOREST",
"to_street": "6669 CHURCH HILL CT",
"amount": 1000.00,
"shipping": 0,
"line_items": [
{
"id": "1",
"quantity": 1,
"unit_price": 1000.00,
"discount": 0
}
]
}
Response
{"tax":{"amount_to_collect":55.0,"breakdown":{"city_tax_collectabl
e":0
.0,"city_tax_rate":0.0,"city_taxable_amount":0.0,"combined_tax_rat
e":0
.055,"county_tax_collectable":5.0,"county_tax_rate":0.005,"county_
taxa
ble_amount":1.0e3,"line_items":[{"city_amount":0.0,"city_tax_rate"
:0.0
,"city_taxable_amount":0.0,"combined_tax_rate":0.055,"county_amoun
t":5
.0,"county_tax_rate":0.005,"county_taxable_amount":1.0e3,"id":"1",
"spe
cial_district_amount":0.0,"special_district_taxable_amount":0.0,"s
peci
al_tax_rate":0.0,"state_amount":50.0,"state_sales_tax_rate":0.05,"
stat
e_taxable_amount":1.0e3,"tax_collectable":55.0,"taxable_amount":1.
0e3}
],"shipping":{"city_amount":0.0,"city_tax_rate":0.0,"city_taxable_
amou
nt":0.0,"combined_tax_rate":0.055,"county_amount":0.0,"county_tax_
rate
":0.005,"county_taxable_amount":0.0,"special_district_amount":0.0,
"spe
cial_tax_rate":0.0,"special_taxable_amount":0.0,"state_amount":0.0
,"st
ate_sales_tax_rate":0.05,"state_taxable_amount":0.0,"tax_collectable":
0.0,"taxable_amount":0.0},"special_district_tax_collectable":0.0,"
spec
ial_district_taxable_amount":0.0,"special_tax_rate":0.0,"state_tax
_col
lectable":50.0,"state_tax_rate":0.05,"state_taxable_amount":1.0e3,
"tax
_collectable":55.0,"taxable_amount":1.0e3},"freight_taxable":true,
"has _nexus":true,"jurisdictions":{"city":"DE
FOREST","country":"US","county":"DANE
COUNTY","state":"WI"},"order_total_amount":1.0e3,"rate":0.055,"shi
ppin g":0.0,"tax_source":"destination","taxable_amount":1.0e3}}
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Jon Paris
Sent: Monday, September 18, 2023 9:13 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: External DATA-INTO not matching variable
Why on earth would they convert it to an exponent form? Makes no sense.
If you included a decimal e.g. 1000.00 would they still do that?
Jon P
On Sep 18, 2023, at 9:53 AM, (WalzCraft) Jerry Forss <JForss@xxxxxxxxxxxxx> wrote:
Fortunately, the element in question is a repeat of what I am sending them. Rather inconsequential.
So I just changed it to send 1001 instead of 1000.
This is using the TaxJar web service so I can verify our taxes on an order.
All I am interested in is the Tax Rates that are returned for the ship to address.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Jon Paris
Sent: Monday, September 18, 2023 8:44 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: External DATA-INTO not matching variable
Data-Into uses %Dec rules to convert the character string to numeric. Those rules state:
If the parameter is a character expression • See Rules for
converting character values to numeric values using built-in functions for the rules for character expressions for %DEC.
• Floating point data, for example '1.2E6', is not allowed.
• If invalid numeric data is found, an exception occurs with status code 105.
In other words the exact symptoms you are experiencing.
The only simple thing I can think of - assuming the folks who send you the JSON won't change it - is to change any fields that may exhibit this issue to character and then manually convert them using $Dec or whatever. That would allow you to use Monitor blocks to trap conversion errors and process them appropriately.
Subject to Change Notice:
WalzCraft reserves the right to improve designs, and to change specifications without notice.
Confidentiality Notice:
This message and any attachments may contain confidential and
privileged information that is protected by law. The information
contained herein is transmitted for the sole use of the intended
recipient(s) and should "only" pertain to "WalzCraft" company
matters. If you are not the intended recipient or designated agent
of the recipient of such information, you are hereby notified that
any use, dissemination, copying or retention of this email or the
information contained herein is strictly prohibited and may subject
you to penalties under federal and/or state law. If you received
this email in error, please notify the sender immediately and
permanently delete this email. Thank You
WalzCraft PO Box 1748 La Crosse, WI, 54602-1748
www.walzcraft.com<http://www.walzcraft.com> Phone: 1-800-237-1326
--
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.
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.
As an Amazon Associate we earn from qualifying purchases.
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.