Author |
Message
|
cloidhamer |
Posted: Mon Apr 02, 2007 3:31 pm Post subject: Conversion |
|
|
Newbie
Joined: 02 Apr 2007 Posts: 6
|
I have been searching through this forum and the WebSphere Knowledgebase for days trying to figure out what I'm doing wrong. First of all I'm programming in VB6 and I'm trying to send binary data converted to Unicode via MQ with an RFH2 header. Using the AX API I have successfully produced the RFH header and attached my data. The problem comes in while adding the data to the message.
Dim objMsg As MQMessage
Set objMsg = New MQMessage
objMsg.Format = FORMAT_MESSAGE_HRF2
objMsg.CharacterSet = 819
objMsg.Encoding = 273
objMsg.Persistence = Int(MQ.MQPER_PERSISTENT)
objMsg.WriteString (RFH2.StrucId)
objMsg.WriteInt4 (RFH2.Version)
objMsg.WriteInt4 (RFH2.StrucLength + mcd_len + jms_len + usr_len + 12)
objMsg.WriteInt4 (RFH2.Encoding)
objMsg.WriteInt4 (RFH2.CodedCharSetId)
objMsg.WriteString (RFH2.Format)
objMsg.WriteInt4 (RFH2.Flags)
objMsg.WriteInt4 (RFH2.NameValueCCSID)
objMsg.WriteInt4 (mcd_len)
objMsg.WriteString (mcd_data)
objMsg.WriteInt4 (jms_len)
objMsg.WriteString (jms_data)
objMsg.WriteInt4 (usr_len)
objMsg.WriteString (usr_data)
objMsg.WriteString (img)
I have tried to set the message encoding and character set to that of the receiving system, but with no joy.
objMsg.CharacterSet = 819
objMsg.Encoding = 273
Can someone tell me what I need to set to make the WriteString command leave my data alone?
Also do any of the variables that are set in the RFH header influence the way the MQMessage handles the message or are they only for the MQ server?
Thanks in advance for any help. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Apr 02, 2007 3:34 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If it's binary data, why are you converting it to Unicode?
Also, 819 is not the CCSID for Unicode. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
cloidhamer |
Posted: Mon Apr 02, 2007 3:57 pm Post subject: |
|
|
Newbie
Joined: 02 Apr 2007 Posts: 6
|
I'm converting it because that is how the people I am working with told me to format the data.
I understand that 819 is not the id for unicode. I haven't been able to figure out what what code or message option will make the writestring command not change my data, that is the answer I seek.
Thanks for the help thus far. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Apr 02, 2007 4:00 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Have you explained to them that it's not actually Unicode data, and it may be entirely meaningless if sent as Unicode?
Writestring will *always* convert the data. Becuase it is built on the assumption that the data is string data, and not binary data.
You can writebytes if you have pure binary. But it won't be Unicode in the message or on the other end...
Is your data actually String data, that happens not to be Unicode? Or is it something like an encrypted stream or an image file, that will be strictly byte data with no meaningful string interpretation? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
cloidhamer |
Posted: Mon Apr 02, 2007 5:13 pm Post subject: |
|
|
Newbie
Joined: 02 Apr 2007 Posts: 6
|
I'm not used to binary so please excuse any bad assumptions I have made. Basically what I'm doing is pulling data that was streamed to a blob field in a database and send that data via MQ with an RFH header. I tried to send directly from the stream, but I get a Type Mismatch error. I know that that means that the ByteData is not the right kind of variable, but what kind does it want?
mystream.Open
mystream.Write rs!File 'Get Blob data from DB
Dim ByteData() As Byte
ByteData = mystream.Read
Create Message and RFH header then write bytes
objMsg.WriteByte ByteData |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Apr 02, 2007 5:22 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well. Okay. But is it a BLOB, or a CLOB? Is it data that is actually supposed to be string data, that happens to be stored in a database as a BLOB... or is it something like an image (which your img variable name suggests)?
I personally probably can't help with the VB/.NET stuff... I haven't done that in quite a while (well, since before there was .NET, really).
According to this: http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzav.doc/csqzav0560.htm
I'd guess you want to use Write() with a byte[] passed in. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
cloidhamer |
Posted: Mon Apr 02, 2007 6:38 pm Post subject: |
|
|
Newbie
Joined: 02 Apr 2007 Posts: 6
|
It's BLOB. Yep. Replaced the WriteString with Write and it took.
mystream.Open
mystream.Write rs!File 'Get Blob data from DB
Dim ByteData() As Byte
ByteData = mystream.Read
Create Message and RFH Header.
objMsg.Write ByteData()
Thanks for the help. |
|
Back to top |
|
 |
|