Page 1 of 1

QDCXLATE Not converting the brackets in JSON String

Posted: Sat Feb 17, 2024 12:14 am
by bbunney
We use QDCXLATE to convert ASCII to EBCDIC for JSON string that come through a web service. It doesn't convert the JSON brackets [ ] correctly. We tried both QEBCDIC and QTCPEBC and it did not work. Got like a '?' instead. We are trying now to use CCSID(1208) on the JSON string to see if that works. I don't want to mess around with iconv() unless I have to. Instead of using one of the IBM Supplied conversion tables, how would we create a conversion table of our own where we could control the translations in it? I checked the IBM info and says we can do it and I was able to create a new conversion table based on QEBCDIC in QSYS in my library but I don't know how to update it. Thanks.

Code: Select all

CRTTBL TBL(BBUNNEY/JEBCDIC) BASETBL(QEBCDIC) SRCFILE(*PROMPT) TEXT('JSON ASCII to EBCDIC Translation Table') 
Table JEBCDIC in library BBUNNEY created.                               

Re: QDCXLATE Not converting the brackets in JSON String

Posted: Sat Feb 17, 2024 3:44 am
by Scott Klement
You shouldn't be converting ASCII to EBCDIC.

Most computers no longer use ASCII. It is an outdated standard... they are using Unicode, not ASCII.

But even if you were... "ASCII" isn't specific. It's a whole family of different character encodings! There are many, many, many different things called "ASCII", and that's why QTCPEBC and QEBCDIC aren't working for you. They are translating from a different ASCII than the one you're using.

Likewise, there are many different EBCDICs... same spiel...

PLEASE PLEASE PLEASE use iconv().

Re: QDCXLATE Not converting the brackets in JSON String

Posted: Sat Feb 17, 2024 5:54 am
by bbunney
Okay I can use iconv(). I have the example code for it. Thanks Scott.