Author |
Message
|
nicojvr |
Posted: Mon Jun 23, 2003 2:03 am Post subject: TDS:Compute node |
|
|
 Apprentice
Joined: 04 Jun 2003 Posts: 45
|
Hi all,
here's the scenario
I get a message into an input node. I then pass it to a compute node and
want to do some text manipulation.
the message comes in in Tagged/ Delimited format with one element(UNB).
I am trying to get the message into a string
Code: |
SET outputString = "InputBody"."UNB"[0];
SET OutputRoot = outputString; |
I get an exception Output message contains no data.
Please help
thanks
Nico |
|
Back to top |
|
 |
Craig B |
Posted: Mon Jun 23, 2003 2:25 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
The outputString is a scalar variable and therefore only represents a single variable and not a subtree. When you do the assignment SET outputString = "InputBody"."UNB"[0]; then you are just copying the value of this single field to the variable outputString and not the subtree it represents. Therefore when you SET OutputRoot = outputString; then you are copying a single value to OutputRoot. This will set the root node value of the OutputRoot message tree to the value in the scalar variable. When building an output message then it is normal practice to create fields in the message body folder such as OutputRoot.MRM, OutputRoot.XML etc. Once again it is unusual to set the values of these folders and you would set the value of these folders, normally fields would be created under these such as SET OutputRoot.MRM.field1 = outputString;.
If you intended to copy a subtree with SET outputString = InputBody.UNB[0], then left hand side of the expression needs to be modifiable tree. In this case you could do something like SET Environment.Variables.mySubTree = InputRoot.UNB[0]; and then compliment that later with SET OuptutRoot.MRM.mySubTree = Environment.Variables.mySubtree; etc.
It should also be noted that in field references indexing starts at 1 not 0, there InputBody.UNB[0] will cause problems in itself. _________________ Regards
Craig |
|
Back to top |
|
 |
nicojvr |
Posted: Mon Jun 23, 2003 2:50 am Post subject: |
|
|
 Apprentice
Joined: 04 Jun 2003 Posts: 45
|
So how do I copy the entire input mrm into a String ? |
|
Back to top |
|
 |
Craig B |
Posted: Mon Jun 23, 2003 2:54 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
It depends on what you mean by Copy the whole MRM input into a string? The whole point of the message tree is to give the user access to their message information in a hierarchy of fields. Are you saying that you want to access the incoming message as-is in a text format? It would be helpful if you uexplained what you are trying to do by giving a brief example. _________________ Regards
Craig |
|
Back to top |
|
 |
nicojvr |
Posted: Mon Jun 23, 2003 3:19 am Post subject: |
|
|
 Apprentice
Joined: 04 Jun 2003 Posts: 45
|
I'm sorry i was trying to do something the stupid way around.
New question same topic:
if my input is a BLOB. how do I get the entire BLOB into a String ?
thanks
Nico
apologies again.. |
|
Back to top |
|
 |
Craig B |
Posted: Mon Jun 23, 2003 3:25 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Code: |
DECLARE myChar CHAR;
DECLARE myMsg BLOB BITSTREAM( InputRoot."BLOB"."BLOB" );
SET myChar = CAST( myMsg CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding );
|
_________________ Regards
Craig |
|
Back to top |
|
 |
Craig B |
Posted: Mon Jun 23, 2003 3:29 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
You can tell Im not awake this morning. In the previous example, you dont need to use the Bitstream function since if your message is already in the BLOB domain then it is already a BLOB. Therefore in this case, the following will work :
Code: |
DECLARE myChar CHAR;
SET myChar = CAST( InputRoot."BLOB"."BLOB" CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding );
|
Or to make it more efficient by doing the assignment on the declaration step
Code: |
DECLARE myChar CHAR CAST( InputRoot."BLOB"."BLOB" CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding );
|
_________________ Regards
Craig |
|
Back to top |
|
 |
nicojvr |
Posted: Mon Jun 23, 2003 3:31 am Post subject: |
|
|
 Apprentice
Joined: 04 Jun 2003 Posts: 45
|
thanks !
Nico |
|
Back to top |
|
 |
|