WRITE JSON with EMBEDDED SQL in SQLRPGLE program

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
giuliocarlomagno
Posts: 7
Joined: Sat Sep 10, 2022 3:59 pm

WRITE JSON with EMBEDDED SQL in SQLRPGLE program

Post by giuliocarlomagno »

Can anyone help me on how to write a numerical field with decimals in cases where this value is less than 1?

DDS DEFINITION
A FIELD084 4S 3 TEXT('DensitaAmbiente')

Example:

C+ Key 'DensitaAmbiente' value P.FIELD084,

If P.Feld084 has the value 1,564, all ok:
"DensitaAmbiente": 1,564,
If P.Feld084 has the value 0.564, Json Format Is Not Correct:
"DensitaAmbiente": .564,
He expects:
"DensitaAmbiente": 0.564,

BR
Giulio Carlomagno
brianjgarland
Posts: 14
Joined: Wed Jul 28, 2021 11:04 am
Location: Vermont, USA
Contact:

Re: WRITE JSON with EMBEDDED SQL in SQLRPGLE program

Post by brianjgarland »

Hello,

You need to add DECEDIT(0,) to your H-spec or CTL-OPT statement.

https://www.ibm.com/docs/en/i/7.3?topic ... brun-value

Brian
giuliocarlomagno
Posts: 7
Joined: Sat Sep 10, 2022 3:59 pm

Re: WRITE JSON with EMBEDDED SQL in SQLRPGLE program

Post by giuliocarlomagno »

Hi Brian. I have already added but obtain the same result.

"DensitaAmbiente":.818
giuliocarlomagno
Posts: 7
Joined: Sat Sep 10, 2022 3:59 pm

Re: WRITE JSON with EMBEDDED SQL in SQLRPGLE program

Post by giuliocarlomagno »

Hi all !
I solved.
I solved.
C + KEY 'DensitaAmbiente' value decfloat (P.FIELD084),
Post Reply