× 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 Raul,

Its important to understand that the 'DATA-INTO' opcode does not tell the parser program the data type of your field.  So you might think "My risk_index field is a number, YAJLINTO should be smart enough to know that it can't assign a character value to it" but, indeed, that's exactly what is happening here...

YAJLINTO defaults to assigning a character value of '*NULL' to any field that is null in the JSON.  Since risk_index is numeric, it can't accept a character value of '*NULL'

Your options are:

1) Change risk_index in your DS to be a character field.  (This is what I would do.)  That way, you can check to see if it contains *NULL, and if so, you'll know that null was the value provided in the document.  When you need to use it in a numeric calculation, simply do numeric_field = %int(risk_index), very easy.

2) Change the value that YAJLINTO uses for nulls to be a valid number.   That is done with a %PARSER option like this: %parser('YAJLINTO': '{ "value_null": "0" }');   --  in this example, I'm assigning 0 to fields that are null.   I don't think this is the best option, however, because this applies to all fields with a null value.  So, card_source, card_country and authorization_number will all get assigned a 0, even though they aren't all numeric.  And, this can make it hard to understand the data you're getting, and hard to detect if the field was null vs. had a numeric value.

Therefore, I would prefer option 1.

-SK


On 8/4/2020 12:17 PM, Raul Alberto Jager Weiler wrote:
I received a json document with some fields null, and that causes RNX 0356
"jsondoc.operation.security_information.risk_index."
This is the document I get:
below is the DS: What can I do?
__________________________________________
{
"operation": {
"token": "3910336e4940927c95d8fb8a4be48a9f",
"shop_process_id": 13813001,
"response": "S",
"response_details": "Procesado Satisfactoriamente",
"amount": "48000.00",
"currency": "PYG",
"authorization_number": null,
"ticket_number": "2466114087",
"response_code": "58",
"response_description": "Transaccion denegada",
"extended_response_description": "EL ESTADO SWITCH DEL
CLIENTE/SUCURSAL ESTA INACTIVO \"I\" - GET024",
"security_information": {
"customer_ip": "201.217.58.22",
"card_source": null,
"card_country": null,
"version": "0.3",
"risk_index": null
}
}
}
______________________________________________
dcl-ds jsonDoc qualified;
dcl-ds operation;
token char(32) ;
shop_process_id packed(15) ;
response char(1) ;
response_details varchar(60) ;
amount packed(15: 2) ;
currency char(3) ;
authorization_number char(6) ;
ticket_number packed(15) ;
response_code char(2) ;
response_description varchar(40) ;
extended_response_description varchar(150) ;
dcl-ds security_information;
customer_ip varchar(40) ;
card_source char(1) ;
card_country varchar(60) ;
version varchar(5) ;
risk_index packed(1) ;
end-ds;
end-ds operation;
end-ds;

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.