ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Tag data not at the beginning of msg - How to parse

Post new topic  Reply to topic
 Tag data not at the beginning of msg - How to parse « View previous topic :: View next topic » 
Author Message
Ramphart
PostPosted: Tue Jul 23, 2013 2:48 am    Post subject: Tag data not at the beginning of msg - How to parse Reply with quote

Disciple

Joined: 21 Jul 2004
Posts: 150
Location: South Africa, JHB

- Windows Server 2008 R2
- Message Broker 7.0 (Ver 7.0.0.5)
- Toolkit 7.0.0.4

CURRENT SCENARIO
Sample Input Message (Every time a "Hdr" appears it denoted the start of a new group)
"Hdr",9,"BIN09_1874","","6507540150083020130107"
"Det",9,"BIN09_1874","","6507540150083020130107"
"Det",9,"BIN09_1874","","6507540150083020130107"
"Tax",9,"BIN09_1874","","6507540150083020130107"
"Tax",9,"BIN09_1874","","6507540150083020130107"
"TTX",9,"BIN09_1874","","6507540150083020130107"
"TTX",9,"BIN09_1874","","6507540150083020130107"
"Hdr",9,"BIN09_1874","","6507540150083020130108"
"Det",9,"BIN09_1874","","6507540150083020130108"
"Det",9,"BIN09_1874","","6507540150083020130108"
"Tax",9,"BIN09_1874","","6507540150083020130108"
"Tax",9,"BIN09_1874","","6507540150083020130108"
"TTX",9,"BIN09_1874","","6507540150083020130108"
"TTX",9,"BIN09_1874","","6507540150083020130108"


The message was modelled as follows:
Code:
-MessageComplete (Repeating Element Delimiter <CR><LF>)
--LocalComplexType ([Choice,Closed], DES=Tagged Delimted, Delimeter <CR><LF>, Length of Tag = 6)
----MessageSingle (Repeating Element Delimiter <CR><LF>)
------LocalComplexType ([orderdSet,Closed], DES=Tagged Delimted, GroupIndicator="Hdr",Delimeter <CR><LF>, Lenth of Tag = 6)
--------InvHeader (Repeating Element Delimiter <CR><LF>)
----------LocalComplexType ([orderdSet,Closed], DES=All Elements Delimited, Delimeter=,)
------------INVDEST
------------DFNAME
------------EDIREF
------------LINKFLD
--------InvLines (Tag="Det", Repeating Element Delimiter <CR><LF>)
----------LocalComplexType ([orderdSet,Closed], DES=All Elements Delimited, Delimeter=,)
------------INVDEST
------------DFNAME
------------EDIREF
------------LINKFLD
--------InvTax (Tag="Tax", Repeating Element Delimiter <CR><LF>)
----------LocalComplexType ([orderdSet,Closed], DES=All Elements Delimited, Delimeter=,)
------------INVDEST
------------DFNAME
------------EDIREF
------------LINKFLD
----MessageSummary (Repeating Element Delimiter <CR><LF>)
------LocalComplexType ([orderdSet,Closed], DES=Tagged Delimted, GroupIndicator="TTX",Delimeter <CR><LF>, Lenth of Tag = 6)
--------TaxSummary (Repeating Element Delimiter <CR><LF>)
----------LocalComplexType ([orderdSet,Closed], DES=All Elements Delimited, Delimeter=,)
------------INVDEST
------------DFNAME
------------EDIREF
------------LINKFLD


Output Trace is:
Code:
--(0x01000021:Name+):MRM        = ( ['mrm' : 0x2596930]
----(0x01000013:Name+):MessageComplete = (
------(0x01000013:Name+):MessageSingle  = (
--------(0x01000013:Name+):InvHeader = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130107"' (CHARACTER)
--------(0x01000013:Name+):InvLines  = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130107"' (CHARACTER)
--------(0x01000013:Name+):InvLines  = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130107"' (CHARACTER)
--------(0x01000013:Name+):InvTax    = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130107"' (CHARACTER)
--------(0x01000013:Name+):InvTax    = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130107"' (CHARACTER)
------(0x01000013:Name+):MessageSummary = (
--------(0x01000013:Name+):TaxSummary = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130107"' (CHARACTER)
------(0x01000013:Name+):MessageSummary = (
--------(0x01000013:Name+):TaxSummary = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130107"' (CHARACTER)
------(0x01000013:Name+):MessageSingle  = (
--------(0x01000013:Name+):InvHeader = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130108"' (CHARACTER)
--------(0x01000013:Name+):InvLines  = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130108"' (CHARACTER)
--------(0x01000013:Name+):InvLines  = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130108"' (CHARACTER)
--------(0x01000013:Name+):InvTax    = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130108"' (CHARACTER)
--------(0x01000013:Name+):InvTax    = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130108"' (CHARACTER)
------(0x01000013:Name+):MessageSummary = (
--------(0x01000013:Name+):TaxSummary = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130108"' (CHARACTER)
------(0x01000013:Name+):MessageSummary = (
--------(0x01000013:Name+):TaxSummary = (
------------(0x0300000B:NameValue+):INVDEST  = '9' (CHARACTER)
------------(0x0300000B:NameValue+):DFNAME   = '"BIN09_1874"' (CHARACTER)
------------(0x0300000B:NameValue+):EDIREF   = '""' (CHARACTER)
------------(0x0300000B:NameValue+):LINKFLD  = '"6507540150083020130108"' (CHARACTER)



NEW SCENARIO

The incoming data now has 3 fields before the tags are reached ("Hdr","Det","Tax","TTX")

"BINV","Customer Invoices1","asdfbc","Hdr",9,"BIN09_1874","","6507540150083020130107"
"BINV","Customer Invoices1","dessf","Det",9,"BIN09_1874","","6507540150083020130107"
"BINV","Customer Invoices1","lmsfc","Det",9,"BIN09_1874","","6507540150083020130107"
"BINV","Customer Invoices1","dea","Tax",9,"BIN09_1874","","6507540150083020130107"
"BINV","Customer Invoices1","dad","Tax",9,"BIN09_1874","","6507540150083020130107"
"BINV","Customer Invoices1","adqqqsc","TTX",9,"BIN09_1874","","6507540150083020130107"
"BINV","Customer Invoices1","adfc","TTX",9,"BIN09_1874","","6507540150083020130107"
"BINV","Customer Invoices2","asdfac","Hdr",9,"BIN09_1874","","6507540150083020130108"
"BINV","Customer Invoices2","asfsdfc","Det",9,"BIN09_1874","","6507540150083020130108"
"BINV","Customer Invoices2","sbc","Det",9,"BIN09_1874","","6507540150083020130108"
"BINV","Customer Invoices2","fbsfc","Tax",9,"BIN09_1874","","6507540150083020130108"
"BINV","Customer Invoices2","erc","Tax",9,"BIN09_1874","","6507540150083020130108"
"BINV","Customer Invoices2","arc","TTX",9,"BIN09_1874","","6507540150083020130108"
"BINV","Customer Invoices2","absfc","TTX",9,"BIN09_1874","","6507540150083020130108"

How can one model this message when the identifying tag is not the first field in the message? It will always be the 4th field. And the message tree in the broker need to be built same as before:
Code:
----(0x01000013:Name+):MessageComplete = (
------(0x01000013:Name+)MessageSingle  = (
--------(0x01000013:Name+):InvHeader = (
--------(0x01000013:Name+):InvLines  = (
--------(0x01000013:Name+):InvLines  = (
--------(0x01000013:Name+):InvTax    = (
--------(0x01000013:Name+):InvTax    = (
------(0x01000013:Name+)MessageSummary = (
--------(0x01000013:Name+):TaxSummary = (
--------(0x01000013:Name+):TaxSummary = (
------(0x01000013:Name+)MessageSingle  = (
--------(0x01000013:Name+):InvHeader = (
--------(0x01000013:Name+):InvLines  = (
--------(0x01000013:Name+):InvLines  = (
--------(0x01000013:Name+):InvTax    = (
--------(0x01000013:Name+):InvTax    = (
------(0x01000013:Name+)MessageSummary = (
--------(0x01000013:Name+):TaxSummary = (
--------(0x01000013:Name+):TaxSummary = (


Thank you in advance for any help
_________________
Applications Architect
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jul 23, 2013 2:56 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Very good problem description - thanks for taking the time.

If you were using DFDL then you could rely on speculative parsing to do this for you. Or you could use a discriminator expression on the record. Or you could use a discriminator with testKind='pattern' to match only the portion of the data up to and including the identifier field.
But in the MRM parser, none of those options are available. You have to use data patterns. So...
1. Change the 'Data Element Separation' property on the inner LocalComplexType from 'Tagged Delimited' to 'Use Data Pattern'.
2. For each type of record, construct a data pattern that describes the entire record and set its 'Data Pattern' property accordingly.

You may need to make other changes to fix errors in the Problems view, but those are the important steps.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Tag data not at the beginning of msg - How to parse
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.