Author |
Message
|
KoGor |
Posted: Wed Nov 09, 2005 3:45 am Post subject: Is it possible to convert MQRFH to MQRFH2? |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
Hi all!
I have incoming message in MQRFH format into my test broker. I need convert this messages into MQRFH2 for following processing.
I tried the following ESQL code but it didn't work:
SET OutputRoot = InputRoot;
SET OutputRoot.MQMD.Format = 'MQHRF2 ';
SET OutputRoot.MQRFH2.Format = 'MQSTR ';
SET OutputRoot.MQRFH2.CodedCharSetId = 1251;
SET OutputRoot.MQRFH2.NameValueCCSID = 1208;
SET OutputRoot.MQRFH2.Version = 2;
SET OutputRoot.MQRFH2.Encoding = 785;
SET OutputRoot.MQRFH2.mcd.Msd = 'MRM';
Has anyone tried to do such conversion before? I'll appreciate any help! Thank you in advance!
Konstantin Gorbunov
P.S. Also I forget to say that I use PROPAGATE to generate several messages after the first arives. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Nov 09, 2005 4:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The code you wrote is going to add an MQRFH2 header to the end of your message.
It does not belong at the end of the message. It belongs in the correct place, after the MQMD and before the body. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
KoGor |
Posted: Wed Nov 09, 2005 5:00 am Post subject: |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
Thank you jefflowrey!
I've got your idea. It works now.
Thank you very much again!
Konstantin Gorbunov |
|
Back to top |
|
 |
KoGor |
Posted: Fri Nov 11, 2005 1:21 am Post subject: |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
It's very strange, but when I try to set this variables
SET OutputRoot.MQRFH2.CodedCharSetId = 1251;
SET OutputRoot.MQRFH2.Encoding = 546;
Broker puts this records into "Other" section of MQRFH2 header of MQ message. Have anyone idea what I doing wrong?
I use the following code now for converting to MQRFH2
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.MQMD = InputRoot.MQMD;
SET OutputRoot.MQMD.Format = 'MQHRF2';
SET OutputRoot.MQMD.Encoding = 546;
SET OutputRoot.MQMD.CodedCharSetId = 1251;
SET OutputRoot.MQRFH2.Format = 'MQSTR';
SET OutputRoot.MQRFH2.CodedCharSetId = 1251;
SET OutputRoot.MQRFH2.NameValueCCSID = 1208;
SET OutputRoot.MQRFH2.Version = 2;
SET OutputRoot.MQRFH2.Encoding = 546;
SET OutputRoot.MQRFH2.mcd.Msd = 'MRM';
SET OutputRoot.MRM = InputRoot.MRM; |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Nov 11, 2005 1:39 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
What do u mean by "other" section, is it like
OutputRoot.Other......????
OR
Two instances created....
OutputRoot.MQFH2[1]
OutputRoot.MQRFH2[2]
Regards. |
|
Back to top |
|
 |
KoGor |
Posted: Fri Nov 11, 2005 1:49 am Post subject: |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
In broker it looks Ok. When message is put in queue I use tool "rfhutil" to get this message out of a queue. On the tab RFH chekbox "other" is active and tab "Other" contains this variables in "Unrecognized folder" in such way:
<Encoding>546</Encoding>
<CodedCharSetId>1251</CodedCharSetId>
Thank you
in advance!
Konstantin Gorbunov |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Nov 11, 2005 2:39 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi KoGor,
Do a search for MQRFH2 in the Toolkit Help....it will throuw up a lot of interesting stuff that u should read. I found some on using multiple MQRFH2..I think you will get your answer there.
Regards. |
|
Back to top |
|
 |
KoGor |
Posted: Fri Nov 11, 2005 2:55 am Post subject: |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
Hm... It was the good advise. I found the answer. Thank you. Really.
Konstantin Gorbunov |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Nov 11, 2005 3:04 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi KoGor,
Great to hear that u got i fixed....
Why dont u tell us what was wrong and what u did to fix it....
Also mark the topic [Solved]
Regards. |
|
Back to top |
|
 |
jhosie |
Posted: Fri Nov 11, 2005 3:06 am Post subject: |
|
|
Apprentice
Joined: 12 May 2005 Posts: 28
|
It seems that your statement to set CCSID and encoding is not creating the correct fields in the RFH2. The fields have the correct name and value but have incorrect types. As you did not specify the type, it is defaulted to a name element with a value child. if you traced it out in a trace node, you would probably see...
Code: |
(0x01000000):CodedCharSetId = (
(0x02000000): = 1251
)
|
whereas it should be a NameValue element. e.g.
Code: |
(0x03000000):CodedCharSetId = 1251
|
When the tree is written to the queue, the RFH2 uses the element whose name is CodedCharSetId AND whose type is NameValue to update the CodePage field in the RFH2. All other elements are placed in the name-value section.
Normally, I would never set the CodedCharSetId directly in the RFH2. The usual approach would be to set it in the Properties folder. This would then update the RFH2 (or which ever header directly precedes the body).
However, you can set it in the RFH2 if you explicitly set the type e.g.
Code: |
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.MQMD = InputRoot.MQMD;
SET OutputRoot.MQMD.Format = 'MQHRF2';
SET OutputRoot.MQMD.Encoding = 546;
SET OutputRoot.MQMD.CodedCharSetId = 1251;
SET OutputRoot.MQRFH2.(NameValue)Format = 'MQSTR';
SET OutputRoot.MQRFH2.(NameValue)CodedCharSetId = 1251;
SET OutputRoot.MQRFH2.(NameValue)NameValueCCSID = 1208;
SET OutputRoot.MQRFH2.(NameValue)Version = 2;
SET OutputRoot.MQRFH2.(NameValue)Encoding = 546;
SET OutputRoot.MQRFH2.mcd.Msd = 'MRM';
SET OutputRoot.MRM = InputRoot.MRM;
|
|
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Nov 11, 2005 3:22 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
jhosie: I think he got the solution.....
KoGor: Can we have ur side of the story.....
Regards. |
|
Back to top |
|
 |
KoGor |
Posted: Fri Nov 11, 2005 4:59 am Post subject: |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
2 elvis_gn:
jhosie is absolutly right I suspected that something wrong with field's type but couldn't catch what exactly. And Elvis_gn gave a wise advise
Now I use the following code:
SET OutputRoot.MQRFH2.(MQRFH2.Field)Format = 'MQSTR ';
SET OutputRoot.MQRFH2.(MQRFH2.Field)NameValueCCSID = 1208;
SET OutputRoot.MQRFH2.(MQRFH2.Field)Version = 2;
SET OutputRoot.MQRFH2.(MQRFH2.Field)Flags = 0;
SET OutputRoot.MQRFH2.(MQRFH2.Field)Encoding = NewEnc;
SET OutputRoot.MQRFH2.(MQRFH2.Field)CodedCharSetId = NewCCID;
And it works fine.
2 jhosie:
Thank you. I'll try to set CodedCharSetId using Properties. I'm rather new in WBIMB and really appreciate your help.
Thank you.
Konstatnin Gorbunov |
|
Back to top |
|
 |
|