DECLARE CasTokenHead CHAR CAST(DecTokenHead AS CHARACTER CCSID 1208);
DECLARE CasTokenBody CHAR CAST(DecTokenBody AS CHARACTER CCSID 1208);
DECLARE Affinity CHAR ;
Now last 3 lines are responsible for casting the resulting blob into something more readable. The problem is, that the result is character and therefore is not handled as JSON. Now I need to access some values inside that JSON and that cannot be really easilly done with one long string I'm stuck here with. Is there a way to cast those CHARs into JSON directly usinq ESQL?
Thanks for any advices
Posted: Tue Jan 17, 2017 5:30 am Post subject: Re: Casting BLOB to JSON
Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
Lone_Wanderer wrote:
Is there a way to cast those CHARs into JSON directly usinq ESQL?
You can't cast any of the variable types into any of the message domains (JSON, XCLNSC, etc) and vice versa.
Use CREATE with the PARSE option to parse (unsurprisingly) the data and create the message tree. Use ASBITSTREAM to perform the reverse, i.e. flatten a message tree into a simple variable type. _________________ Honesty is the best policy.
Insanity is the best defence.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum