View previous topic :: View next topic
|
Author |
Message |
Zilla
New User
Joined: 03 Jun 2023 Posts: 11 Location: india
|
|
|
|
Hi Folks, I was using jsonPutValue function to map PL/I structure to JSON. So I used ReadText = jsonPutValue ( pJSON, nJSON, c), c here is my PL/I DCL structure with some init values. Now it works and ReadText is written with number of bytes written to buffer. pJSON is pointer to the buffer and nJSOn is the length of the buffer and buffer is dcl JSONtext char(1000) var. Now what if I want to actually see the JSON structure is there any way? I tried to display the buffer itself which is JSONtext but it comes as blank. Any idea how can I achieve that? On the other hand jsonGetValue works fine, so it takes JSON structure and maps it to PL/I and I am able to display the PL/I structure with correct values. Thanks. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1315 Location: Vilnius, Lithuania
|
|
|
|
Show all declarations! |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
prino wrote: |
Show all declarations! |
Including: Income Declaration Form FL-150! |
|
Back to top |
|
|
Zilla
New User
Joined: 03 Jun 2023 Posts: 11 Location: india
|
|
|
|
Below:
dcl JSONtext char(1000) var; /* Buffer holding JSON text */
dcl ReadText fixed bin(31);
dcl pJSON pointer; /* pointer to buffer */
dcl nJSON fixed bin(31); /* length of buffer */
dcl 1 c, 2 d fixed bin init(2), 2 e fixed bin init(3);
pJSON = addrdata(JSONtext); /* set buffer pointer */
nJSON = length(JSONtext); /* set buffer length */
ReadText = jsonPutValue ( pJSON, nJSON, c);
Put skip list(ReadText)
Put skip list(JSONtext) |
|
Back to top |
|
|
Zilla
New User
Joined: 03 Jun 2023 Posts: 11 Location: india
|
|
|
|
sergeyken are you from from tax department |
|
Back to top |
|
|
Zilla
New User
Joined: 03 Jun 2023 Posts: 11 Location: india
|
|
|
|
I tried UTF8 function as well on buffer assuming it is converted to UTF8 when put in JSON format but nothing gets displayed. So not too sure how can I display my JSON structure with data converted from PL/I structure.
I am trying this example only in IBM manual:
dcl 1 c, 2 d fixed bin init(2), 2 e fixed bin init(3);
dcl buffer char(1000);
dcl p pointer;
dcl n fixed bin(31);
p = addr(buffer);
n = length(buffer);
written = jsonPutValue( p, n, c );
The above code writes the following UTF-8 string to the buffer, and assigns the value 13 to the variable written.
{"D":2,"E":3}
www.ibm.com/docs/en/epfz/5.3?topic=subroutines-jsonputvalue
I want to display this data {"D":2,"E":3} and I am assuming it will be stored in buffer but displaying buffer shows blank nothing else. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Zilla wrote: |
sergeyken are you from from tax department |
I’ve had three contracts with IRS, and 6-years contract with SSA |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1315 Location: Vilnius, Lithuania
|
|
|
|
And what does
Code: |
put skip list(length(buffer)); |
show? |
|
Back to top |
|
|
Zilla
New User
Joined: 03 Jun 2023 Posts: 11 Location: india
|
|
|
|
Thank you Prino for your time on this, it works now. I have just changed Buffer declaration from varying to normal. I was able to see the data in readable format after converting it from UTF 8 to EBCDIC. |
|
Back to top |
|
|
|