Author |
Message
|
srindies |
Posted: Sun Feb 12, 2006 3:29 am Post subject: Problem in setting up Message type for FL to XML Conversion |
|
|
Apprentice
Joined: 06 Jan 2006 Posts: 28
|
Hi All,
I have a requirement to convert Fixed Length message to XML message. I have a set of XML definitions from XML schemas and defined logical model for Fixed length messages seperately. I have around 14 FL messages defined in my project. Hierarchy of it is given below.
Quote: |
SampleFLMessageSetProject
--->SampleFLMessageSet
------->14 Message Definitions
|
My Message flow,
Quote: |
MQInput Node (FL Message) ---> Compute Node (FL- XML Conv) --> MQOutput Node
|
Now, for Initial parsing the input FL message, I have set Message Domain, Message Set, Message Type and Message Format in MQInput Node and it worked well.
But I want to set Message Type property at runtime. I need to change Message Type property to any of 14 message definitions mentioned above based on the input message and parse it accordingly. I am not able to set it in esql at compute node.
Thanks & Regards,
Sridhar H |
|
Back to top |
|
 |
JT |
Posted: Sun Feb 12, 2006 8:04 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Try this:- Set the message domain on the MQInput node to BLOB.
- In your ESQL code, dynamically decide which Message Type the payload conforms to.
- Issue a CREATE statement, with the DOMAIN and PARSE clauses, specifiying the Message Type (as well as the other required parms) on the PARSE clause.
For examples, check out the Information Center, and also perform a search on this site for CREATE DOMAIN & PARSE. |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Feb 12, 2006 10:25 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What's the error that occurs when you try to set the Message Type?
Have you used CopyMessageHeaders or CopyEntireMessage in the node that is supposed to be creating the XML message? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
srindies |
Posted: Sun Feb 12, 2006 11:06 pm Post subject: |
|
|
Apprentice
Joined: 06 Jan 2006 Posts: 28
|
Thanks JT,
Is it possible to set Message set and message domain from the Input message at runtime. My Sample FL Message is similar to ..
Quote: |
Sample 1:
Asynchronous Request EMSIMM003
Sample 2:
Asynchronous Request EMSIMM002
|
Based on EMSIMM003/EMSIMM002, I need to set my message type.
Jeff:
I tried the following command in my Compute node.
Quote: |
Set InputRoot.Properties.MessageSet = 'EMSIMM003';
|
and received the following error message,
Quote: |
Error Input correlation name InputRoot cannot be changed. SAMPLE_FL_XML_FLOW.esql SAMPLE_FL_TRANSFORM_PROJECT line 8
|
Thanks & Regards,
Sridhar H[/b] |
|
Back to top |
|
 |
shalabh1976 |
Posted: Mon Feb 13, 2006 12:38 am Post subject: |
|
|
 Partisan
Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India
|
You never need to modify the InputRoot. You need to change the OutputRoot. _________________ Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate |
|
Back to top |
|
 |
shalabh1976 |
Posted: Mon Feb 13, 2006 12:45 am Post subject: |
|
|
 Partisan
Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India
|
You can also code using multiple if then else statements where you specify the value of the message set, message type and domain.
You can also use the CREATE statement as suggested.
Since you have 14 possible messages, you can also use a route to label node where each route takes you to a Reset Content Descriptor node. This will yield a much cleaner code. _________________ Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate |
|
Back to top |
|
 |
srindies |
Posted: Mon Feb 13, 2006 1:02 am Post subject: |
|
|
Apprentice
Joined: 06 Jan 2006 Posts: 28
|
Thanks shalabh,
I have been using following ESQL code to route based on the content in Input message.
Quote: |
SET OutputRoot.Properties.MessageSet = 'CAMO88K002001';
CASE InputBody.TransactionCode
WHEN 'EMSIMM002' THEN CALL EMSIMM002();
WHEN 'EMSIMM003' THEN CALL EMSIMM003();
WHEN 'EMSIMM004' THEN CALL EMSIMM004();
WHEN 'EMSIMM007' THEN CALL EMSIMM007();
WHEN 'EMSIMM010' THEN CALL EMSIMM010();
WHEN 'EMSIMM011' THEN CALL EMSIMM011();
WHEN 'EMSIMM012' THEN CALL EMSIMM012();
WHEN 'EMSIMM014' THEN CALL EMSIMM014();
END CASE;
|
Here, TransactionCode is used for routing and I am reading it from input message. Is it possible to get the value before parsing using BLOB Domain. Please refer my previous sample messages.
Thanks & Regards,
Sridhar H |
|
Back to top |
|
 |
shalabh1976 |
Posted: Mon Feb 13, 2006 2:20 am Post subject: |
|
|
 Partisan
Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India
|
In one node you can use either the BLOB , MRM or XML parser to parse the input message. If your input message can be parsed by a single MRM then you can definitely define a messase set element to hold the value of transaction code. What processing you do subsequently will be based either on how you have defined your input message set or by using the SUBSTRING CLAUSE by parsing the input message as a BLOB/ASBITSTREAM. _________________ Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate |
|
Back to top |
|
 |
dipankar |
Posted: Mon Feb 13, 2006 3:31 am Post subject: |
|
|
Disciple
Joined: 03 Feb 2005 Posts: 171
|
Why are you not following JT's suggestion?
Quote: |
Here, TransactionCode is used for routing and I am reading it from input message. Is it possible to get the value before parsing using BLOB Domain. Please refer my previous sample messages. |
How can you extract InputBody.TransactionCode before BLOB parsing? Use Blob as message domain in MQInput Node to extract InputBody.TransactionCode.
This is my suggestion-
MQInput Node (use Blob Parser) ---> Compute Node ---> MQOutput Node
In the compute node you extract transactionCode by substring. After that you use if then clause like
IF TransactionCode = 'EMSIMM002' then
SET OutputRoot.Properties.MessageSet = 'XXXXXXXXXXXXX';
SET OutputRoot.Properties.MessageType = 'YYYYYY';
SET OutputRoot.Properties.MessageDomain = 'XML';
SET OutputRoot.Properties.MessageFormat = 'XML';
--code for message body
ELSE
IF TransactionCode = 'EMSIMM003' then
SET OutputRoot.Properties.MessageSet = 'XXXXXXXXXXXXX';
SET OutputRoot.Properties.MessageType = 'ZZZZZZ';
SET OutputRoot.Properties.MessageDomain = 'XML';
SET OutputRoot.Properties.MessageFormat = 'XML';
--code for message body
IF
----
---- _________________ Regards |
|
Back to top |
|
 |
srindies |
Posted: Mon Feb 13, 2006 5:04 am Post subject: |
|
|
Apprentice
Joined: 06 Jan 2006 Posts: 28
|
Hi All,
I am planning to use BLOB Message Domain and parse input message accordingly. Fourtunately I have FL message format and I could figure out the TransactionCode from my input message.
Quote: |
SET s1 = SUBSTRING(InputRoot.BLOB.BLOB FROM 30 FOR 10);
SET OutputRoot.MQMD.CodedCharSetId = 437;
SET OutputRoot.MQMD.Encoding = 546;
|
Now, I am getting message in Hex number and I want to convert it into ASCII Character for my operation.
Quote: |
Current Output:
X'20454d53494d4d303033'
Required Output:
EMSIMM003
|
It seems that I have set CodedCharSetId and Encoding property correctly. I still wonder why am I getting output as Hex number. Do I need to set any other property for this conversion?
Thanks & Regards,
Sridhar H |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 13, 2006 5:20 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Code: |
SET s1 = cast(SUBSTRING(InputRoot.BLOB.BLOB FROM 30 FOR 10) as char CCSID InputRoot.Properties.CodedCharSetId); |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
srindies |
Posted: Tue Feb 14, 2006 11:29 pm Post subject: |
|
|
Apprentice
Joined: 06 Jan 2006 Posts: 28
|
Thanks All,
I have set Message Domain to BLOB and extracted Transaction Code from the input message. Based on transaction code, I converted it into XML Message and forward it to the Output node.
Final ESQL:
Quote: |
DECLARE transactionCode CHARACTER;
SET transactionCode = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 31 FOR 10) as char CCSID InputRoot.Properties.CodedCharSetId);
SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageSet = 'CBGE2SC002001';
SET OutputRoot.Properties.MessageFormat = 'XML';
CASE transactionCode
WHEN 'EMSIMM002' THEN CALL EMSIMM002();
WHEN 'EMSIMM003' THEN CALL EMSIMM003();
WHEN 'EMSIMM004' THEN CALL EMSIMM004();
WHEN 'EMSIMM007' THEN CALL EMSIMM007();
WHEN 'EMSIMM010' THEN CALL EMSIMM010();
WHEN 'EMSIMM011' THEN CALL EMSIMM011();
WHEN 'EMSIMM012' THEN CALL EMSIMM012();
WHEN 'EMSIMM014' THEN CALL EMSIMM014();
END CASE;
|
In each transformation routine, I used CAST and SUBSTRING function to extract and map it to XML Message.
Quote: |
SET OutputRoot.Properties.MessageType = 'EMSIMM002';
SET OutputRoot.MRM.ApplicationHeader.TransmissionMode = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 1 FOR 15) as char CCSID InputRoot.Properties.CodedCharSetId);
SET OutputRoot.MRM.ApplicationHeader.TransactionType = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 16 FOR 15) as char CCSID InputRoot.Properties.CodedCharSetId);
SET OutputRoot.MRM.ApplicationHeader.TransactionCode = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 31 FOR 15) as char CCSID InputRoot.Properties.CodedCharSetId);
SET OutputRoot.MRM.ApplicationHeader.TransactionDateTime = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 46 FOR 20) as char CCSID InputRoot.Properties.CodedCharSetId);
|
I have tested my flow successfully. Its working fine. Thanks alot.
Regards,
Sridhar H |
|
Back to top |
|
 |
|