Author |
Message
|
Thomas |
Posted: Fri Feb 28, 2003 1:51 pm Post subject: convert mixed charsets within blob |
|
|
Novice
Joined: 25 Sep 2002 Posts: 10 Location: Germany
|
hi all,
i'll get from mvs-mqhost a mixed-charset-ebcdic-blob message.
let me explain (for example):
from 1-100 the host charsetset is 273 (western europe)
from 101-200 the host charset is 875 (greece)
how can i convert this via compute-node to a valid utf-8 (ccsid=1208) xml-file ?
i think that mustbe something like that:
SET var1=CONVERT(SUBSTRING(xxx from 1 for 100) ccsid-from to ccsid-to)
can you help me ?
best regards from germany,
thomas |
|
Back to top |
|
 |
kirani |
Posted: Fri Feb 28, 2003 2:36 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
How are you planning to parse your input message, are you planning to use MRM-CWF or BLOB or something else?
Are you planning to send text in 1-100 and 101-200 position into 2 different xml tags? _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Thomas |
Posted: Sat Mar 01, 2003 9:27 am Post subject: |
|
|
Novice
Joined: 25 Sep 2002 Posts: 10 Location: Germany
|
First of all I reset the BLOB to MRM. Within computenote i'll generate the utf8-XML-output.
Please note: The example above is only the principle problem. For each textelement in MRM-structure
i'll get a languagecode (DEU, GRC, ..) witch let me decide the matching 'from-charset'. |
|
Back to top |
|
 |
kirani |
Posted: Sun Mar 02, 2003 8:38 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
In that case you can use something like this
Code: |
IF ( InputRoot.MRM.yyy = some-lang-code) then
SET OutputRoot.XML.Data.String1 = CAST ( SUBSTRING (xxx FROM 1 FOR 100) AS CHAR CCSID ccsid-to);
END IF;
|
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Thomas |
Posted: Mon Mar 03, 2003 1:10 am Post subject: |
|
|
Novice
Joined: 25 Sep 2002 Posts: 10 Location: Germany
|
unfortunately I don't understand this ;-?
the ccsid-to is always 1208, but the 'ccsid-from' depends on lang-code as described above. |
|
Back to top |
|
 |
kirani |
Posted: Mon Mar 03, 2003 10:00 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I Hope this will be more clear,
1. Read your input message as BLOB in MQInput node.
2. In a compute node, first get language code using SUBSTRING function. Also, get the string data associated with this lang code and then apply CAST function to convert it into corresponding CCSID.
For example,
Code: |
DECLARE LANG_CODE CHAR;
-- Get Language code
SET LANG_CODE = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM x FOR 3) AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
IF ( LANG_CODE = 'GRC') THEN
SET OutputRoot.XML.Data.Text1 = CAST(InputRoot.BLOB.BLOB FROM YY FOR XXX) AS CHAR CCSID YYYY);
-- Here, YYYY is CCSID for GRC language.
END IF;
-- Similarly, transform other language data.
-- Finally Transform the output message to 1208 CCSID.
SET OutputRoot.Properties.CodedCharSetId = 1208;
|
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Thomas |
Posted: Tue Mar 04, 2003 11:49 am Post subject: |
|
|
Novice
Joined: 25 Sep 2002 Posts: 10 Location: Germany
|
It WORKS ! Thank you very much !
But I still don't know how it works
I thought that the ccsid within cast is always the ccsid-TO. But in your solution the ccsid is the ccsid-FROM. How does WMQI know the
FROM<=>TO conversion ? |
|
Back to top |
|
 |
kirani |
Posted: Tue Mar 04, 2003 9:31 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
That's correct! CCSID in CAST is always the CCSID-TO.
In above code, I am first converting the BLOB string to appropriate language CCSID and then converting the complete message to CCSID 1208. We had to do conversion in 2-stage because your input message contains data of mixed CCSID. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
|