Author |
Message
|
nathanw |
Posted: Wed Mar 02, 2005 2:46 am Post subject: outputing inbound XML value as a string on q |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
we have a multi output functionality that requires part of the input tree ie one field to be output to a separate q as a string
this can be repeating and therefore I am PROPAGATING within a cardinality loop for each instance in the message
how do i convert the field content value to a string and output it to the q?
the input tree is XML
Code: |
input
<xml>
<FIELD1>abcd</FIELD1>
<XML>
output required
abcd
|
many thanks |
|
Back to top |
|
 |
Craig B |
Posted: Wed Mar 02, 2005 3:08 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
To output text, you will need to use the BLOB domain since characters are just hex bytes represented by a specific Codepage. This should do the job :
Code: |
DECLARE InRef REFERENCE TO InputRoot.XML.xml.FIELD1[1];
WHILE LASTMOVE(InRef) DO
CALL CopyMessageHeaders();
SET OutputRoot.BLOB.BLOB = CAST(FIELDVALUE(InRef) AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);
PROPAGATE;
MOVE InRef NEXTSIBLING NAME 'FIELD1';
END WHILE;
RETURN FALSE;
|
Hope this helps. _________________ Regards
Craig |
|
Back to top |
|
 |
nathanw |
Posted: Wed Mar 02, 2005 3:28 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
Craig B wrote: |
Hi,
To output text, you will need to use the BLOB domain since characters are just hex bytes represented by a specific Codepage. This should do the job :
Code: |
DECLARE InRef REFERENCE TO InputRoot.XML.xml.FIELD1[1];
WHILE LASTMOVE(InRef) DO
CALL CopyMessageHeaders();
SET OutputRoot.BLOB.BLOB = CAST(FIELDVALUE(InRef) AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);
PROPAGATE;
MOVE InRef NEXTSIBLING NAME 'FIELD1';
END WHILE;
RETURN FALSE;
|
Hope this helps. |
Criag many thanks
thsi loks to be exactly what I need unfortunately I think there is a problem in the code it is saying that at this point
Code: |
WHILE LASTMOVE(InRef) DO |
There is a syntax error in the code and the only valid options are
Create Decalre End
any ideas? |
|
Back to top |
|
 |
Craig B |
Posted: Wed Mar 02, 2005 3:48 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
The code compiles into a CMF files and deploys to my V5 FP05 broker. What Version and FP level are you using? _________________ Regards
Craig |
|
Back to top |
|
 |
Craig B |
Posted: Wed Mar 02, 2005 3:50 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Obviously I meant FP04 broker.  _________________ Regards
Craig |
|
Back to top |
|
 |
nathanw |
Posted: Wed Mar 02, 2005 4:10 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
V5 FP04
according to my system anyway |
|
Back to top |
|
 |
nathanw |
Posted: Wed Mar 02, 2005 5:37 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
Ok got it working woohoo!
many thanks |
|
Back to top |
|
 |
|