IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Help on PL/I jsonPutValue function


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Zilla

New User


Joined: 03 Jun 2023
Posts: 11
Location: india

PostPosted: Wed Jul 12, 2023 6:27 pm
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Wed Jul 12, 2023 7:27 pm
Reply with quote

Show all declarations!
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2024
Location: USA

PostPosted: Wed Jul 12, 2023 7:31 pm
Reply with quote

prino wrote:
Show all declarations!

Including: Income Declaration Form FL-150! icon_biggrin.gif
Back to top
View user's profile Send private message
Zilla

New User


Joined: 03 Jun 2023
Posts: 11
Location: india

PostPosted: Wed Jul 12, 2023 8:46 pm
Reply with quote

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
View user's profile Send private message
Zilla

New User


Joined: 03 Jun 2023
Posts: 11
Location: india

PostPosted: Wed Jul 12, 2023 8:47 pm
Reply with quote

sergeyken are you from from tax department icon_biggrin.gif
Back to top
View user's profile Send private message
Zilla

New User


Joined: 03 Jun 2023
Posts: 11
Location: india

PostPosted: Wed Jul 12, 2023 8:52 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2024
Location: USA

PostPosted: Thu Jul 13, 2023 12:58 am
Reply with quote

Zilla wrote:
sergeyken are you from from tax department icon_biggrin.gif

I’ve had three contracts with IRS, and 6-years contract with SSA 358.gif
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Jul 13, 2023 1:03 am
Reply with quote

And what does
Code:
put skip list(length(buffer));
show?
Back to top
View user's profile Send private message
Zilla

New User


Joined: 03 Jun 2023
Posts: 11
Location: india

PostPosted: Sat Jul 15, 2023 6:46 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
No new posts INSYNC option with same function as I... JCL & VSAM 0
No new posts FUNCTION NUMVAL problem COBOL Programming 6
Search our Forums:

Back to Top