|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
TDS: Tags order |
« View previous topic :: View next topic » |
Author |
Message
|
scravr |
Posted: Wed Oct 22, 2008 1:27 pm Post subject: TDS: Tags order |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
HI All,
I have TDS msg-definition with: fix-length-HDR, unorderedSet-closed-tag-delimited-group, and fix-length-TRLR.
The group (as a message body) has 15 unordered OPTIONAL tag lines.
Each tag comes on individual line with <CR><LF>
There is NO order for tags (Tag1 can come before/after Tag2 or before/after Tag3, or before/after Tag4...... and Tag2 can come before/after Tag1 or before/after Tag3, or before/after Tag4...... )
Basically tags have NO order.
Question in flow:
How can I findout the order of input tags on the incoming msg?
I need to run a logic depend on tag orders.
Here are few samples:
HDRrecord0110081166
/Tag5/text
/Tag3/text
/Tag1/text
TRLRdata
HDRrecord0110081212
/Tag2/text
/Tag6/text
/Tag1/text
TRLRdata
Can ESQL/JAVA code help or this is done by MRM parser and indication is not pass to flow?
Any ideas ?
Thanks,
Moshe |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 22, 2008 1:31 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Yes, you can do this in ESQL. What I mean is, you can FIND OUT what order the records are in.
The records will appear in the tree in the order that they appear in the message.
If you make your message definition correctly. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 22, 2008 2:20 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi there,
Just wondering why you didn't
a) try it in the debugger or
b) insert a Trace node with pattern '$Root'
Either way you would have been able to see immediately that the message tree is built in the order in which the elements occur in the input. |
|
Back to top |
|
 |
broker_new |
Posted: Wed Oct 22, 2008 3:13 pm Post subject: |
|
|
 Yatiri
Joined: 30 Nov 2006 Posts: 614 Location: Washington DC
|
Sorry, I may have not understood your post correctly but as per my understanding i think you haven't defined the Message Set properly.
Create a type defnition for each tag elements.In your case there will be 3 type defnitions in message set.
Group Indicator for tag5 type would be /tag5(no idea whether it accepts "/" or not if it doesn't search for the unicode char value for it)
///ly GI for tag3 type would be "/tag3"
GI for tag1 type would be "/tag1"
Create one more type called Complete message and refer these three types in it and change the minoccurs to 0 and maxoccurs to 1.
particular tag type would be invoked depending upon the GI value set. _________________ IBM ->Let's build a smarter planet |
|
Back to top |
|
 |
scravr |
Posted: Thu Oct 23, 2008 8:12 am Post subject: Tags order |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
Here is part of code/debug/trace.
1. In compute node I have:
..
..
..
BEGIN
CALL CopyEntireMessage();
SET OutputRoot.Properties.MessageSet = 'ABCD0C4002001';
SET OutputRoot.Properties.MessageFormat = 'ABCDEFG_BNRY';
SET OutputRoot.MQMD.Format = 'MQSTR ';
SET OutputRoot.MRM = NULL;
...
...
...
2. Trace:
...
...
...
Body: (
(0x01000013):RplyHDR = (
(0x0300000B):StatusCode = 'xyz'
(0x0300000B):MsgDate = '081020'
(0x0300000B):MsgTime = '153039'
(0x0300000B):MsgType = 'acb'
(0x0300000B):Auth = 'none'
)
(0x01000013):HDR = (
(0x0300000B):TypeLvl = '12'
(0x0300000B):MsgType = 'abc'
(0x0300000B):AcctId = 'xyx'
(0x0300000B):ElementLength1 = '0'
(0x0300000B):RefID = '08800041 '
(0x0300000B):MsgDate = '081020'
(0x0300000B):MsgTime = '150251'
(0x0300000B):Auth = 'moshe'
(0x0300000B):ElementLength8 = ' '
)
(0x01000013):MsgBody = (
(0x0300000B):ErrorMessage = '12345z123y12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456'
(0x0300000B):ErrText2 = '12345z123y12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456'
(0x0300000B):ErrText3 = '12345z123y12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456'
)
(0x01000013):Eom = (
(0x0300000B):EndOfMsg = '//'
)
)
'' from trace node 'FlowName.FL_WMB_BACKUP_FLOW.Trace'.
The trace node 'FlowName.FL_WMB_BACKUP_FLOW.Trace' has output the specified trace data.
This is an information message provided by the message flow designer. The user response will be determined by the local environment.
2008-10-23 11:26:06.773169 200 UserTrace BIP4067I: Message propagated to output terminal for trace node 'FlowName.FL_WMB_BACKUP_FLOW.Trace'.
The trace node 'FlowName.FL_WMB_BACKUP_FLOW.Trace' has received a message and is propagating it to any nodes connected to its output terminal.
No user action required.
2008-10-23 11:26:06.774038 200 UserTrace BIP2638I: The MQ output node 'FlowName.FL_WMB_BACKUP_FLOW.MQOutput' attempted to write a message to queue ''Backup001'' connected to queue manager ''''. The MQCC was '0' and the MQRC was '0'.
2008-10-23 11:26:06.774048 200 UserTrace BIP2622I: Message successfully output by output node 'FlowName.FL_WMB_BACKUP_FLOW.MQOutput' to queue ''Backup001'' on queue manager ''''.
2008-10-23 11:26:06.774312 200 UserTrace BIP4164I: Message propagated to the second terminal of the FlowOrder node 'FlowName.FlowOrder'.
The FlowOrder node has finished processing a message down the first terminal and has propagated it to the second terminal.
No user action required.
2008-10-23 11:26:06.776351 200 UserTrace BIP2537I: Node 'FlowName.Compute1': Executing statement ''BEGIN ... END;'' at ('.FlowName_Compute1.Main', '2.2').
2008-10-23 11:26:06.776382 200 UserTrace BIP2537I: Node 'FlowName.Compute1': Executing statement ''CopyEntireMessage();'' at ('.FlowName_Compute1.Main', '3.3').
2008-10-23 11:26:06.776402 200 UserTrace BIP2538I: Node 'FlowName.Compute1': Evaluating expression ''CopyEntireMessage()'' at ('.FlowName_Compute1.Main', '3.8').
2008-10-23 11:26:06.776452 200 UserTrace BIP2537I: Node 'FlowName.Compute1': Executing statement ''BEGIN ... END;'' at ('.FlowName_Compute1.CopyEntireMessage', '1.39').
2008-10-23 11:26:06.776480 200 UserTrace BIP2537I: Node 'FlowName.Compute1': Executing statement ''SET OutputRoot = InputRoot;'' at ('.FlowName_Compute1.CopyEntireMessage', '2.3').
2008-10-23 11:26:06.776599 200 UserTrace BIP2539I: Node 'FlowName.Compute1': Evaluating expression ''InputRoot'' at ('.FlowName_Compute1.CopyEntireMessage', '2.20'). This resolved to ''InputRoot''. The result was ''ROW... Root Element Type=16777216 NameSpace='' Name='Root' Value=NULL''.
2008-10-23 11:26:06.776679 200 UserTrace BIP2568I: Node 'FlowName.Compute1': Copying sub-tree from ''InputRoot'' to ''OutputRoot''.
2008-10-23 11:26:06.801786 200 UserTrace BIP5609I: ''
'' has been matched as a delimiter for ''/MsgLvl'' at byte '23'.
2008-10-23 11:26:06.810875 200 UserTrace BIP5609I: ''
'' has been matched as a delimiter for ''/MsgLvl'' at byte '78'.
2008-10-23 11:26:06.814133 200 UserTrace BIP5612I: ''/ERROR/'', ending at byte '86', was matched as the tag for ''/MsgLvl/MsgBody/BodyGrp/ErrorMessage''.
2008-10-23 11:26:06.816194 200 UserTrace BIP5609I: ''
'' has been matched as a delimiter for ''/MsgLvl/MsgBody/BodyGrp'' at byte '243'.
2008-10-23 11:26:06.821630 200 UserTrace BIP5612I: ''/ERR2/'', ending at byte '249', was matched as the tag for ''/MsgLvl/MsgBody/BodyGrp/ErrText2''.
2008-10-23 11:26:06.823359 200 UserTrace BIP5609I: ''
'' has been matched as a delimiter for ''/MsgLvl/MsgBody/BodyGrp'' at byte '406'.
2008-10-23 11:26:06.825068 200 UserTrace BIP5612I: ''/ERR3/'', ending at byte '411', was matched as the tag for ''/MsgLvl/MsgBody/BodyGrp/ErrText3''.
2008-10-23 11:26:06.826507 200 UserTrace BIP5609I: ''
'' has been matched as a delimiter for ''/MsgLvl/MsgBody/BodyGrp'' at byte '568'.
2008-10-23 11:26:06.829529 200 UserTrace BIP5617I: Checking for an alternative meaning for markup found at byte '568'.
2008-10-23 11:26:06.829634 200 UserTrace BIP5609I: ''
'' has been matched as a delimiter for ''/MsgLvl/MsgBody'' at byte '568'.
2008-10-23 11:26:06.829782 200 UserTrace BIP5617I: Checking for an alternative meaning for markup found at byte '568'.
2008-10-23 11:26:06.829895 200 UserTrace BIP5609I: ''
'' has been matched as a delimiter for ''/MsgLvl'' at byte '568'.
2008-10-23 11:26:06.852271 200 UserTrace BIP5607I: The end of the bit stream has been reached at byte '572'.
That means:
/ERROR/ was mapped to ErrorMessage
/ERR2/ was mapped to ErrText2
/ERR3/ was mapped to ErrText3
How in esql can I point/get to first TDS input line? (the first mapping of MsgBody)
Remember: each tag comes on individual line delimited by <CR><LF>. Tags may/can come in NO specific order. (see my first posting above)
On msg-definition (broker 6.1) I have msg-level-element, pointing to 4 types: fix-lenght-hdr1, tds-body, fix-lenght-hdr1, fix-lenght-trlr
body type points to group. the group has 17 local simple-restricted-string-type elements; each has tag like: /ERR2/, /ERR3/.... |
|
Back to top |
|
 |
scravr |
Posted: Thu Oct 23, 2008 10:08 am Post subject: Tags order |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
Done.
SET ErrText = InputRoot.MRM.Body.[1]; --- get first body element. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Oct 30, 2008 4:41 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Glad you got it working, but there may be a better way.
I think you are using All Elements Delimited in your message set, and using a single repeating element to represent all 15 record types. If you had posted a trace of the message tree ( from a Trace node ) I would have known for sure
broker_new tried to suggest another approach using Group Indicators. That would work, but would still not be the ideal approach ( because tags are the proper mechanism for dealing with tagged data )
This is the natural model for your message. It will result in a different element name for each of the 15 record types.
Code: |
Message DES="Tagged Delimited", TagLength="0"
Header [you know how to do this part]
Body DES="Tagged Delimited", TagDataSeparator="/"
Element Name="Record1" Tag="/Tag1"
Element Name="Record2" Tag="/Tag2"
Element Name="Record3" Tag="/Tag3"
Trailer [you know how to do this part]
|
In your ESQL you simply output the 15 record types in the correct order. You can test for NULL if some of the records can be omitted. No need to rely on the position of the element in the message tree any more because each record has a unique name, and can be accessed by name. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|