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 » Need help with record repetition in message sets

Post new topic  Reply to topic
 Need help with record repetition in message sets « View previous topic :: View next topic » 
Author Message
nemani
PostPosted: Fri May 08, 2015 12:21 pm    Post subject: Need help with record repetition in message sets Reply with quote

Newbie

Joined: 21 Nov 2014
Posts: 5

Hi:

I am new to the message sets, and am trying to generate the following output record:

HEADER
RECORD1
RECORD2
RECORD3
RECORD4
RECORD4
RECORD3
RECORD4
RECORD5
END

The records are fixed length. Record 4 could occur multiple times after RECORD3. RECORD3 itself is not repetitive. But the combination for RECORD3 and RECORD4 is.


I am using TDS wire format.

I created a complex type, called DETAILS and configured it to have min occurs as 1 and max occurs as -1. I made RECORD3 and RECORD4 are elements under this complex type. With this set up, I get the following:

....
RECORD3
RECORD4
RECORD3
RECORD4
...

I tried defining another complex type (ITEMS) and made RECORD4 its element and configured ITEMS to have max occurs as -1 with no luck.

Would using DFDL have made it easier?

Please help.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri May 08, 2015 12:23 pm    Post subject: Re: Need help with record repetition in message sets Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

nemani wrote:
Would using DFDL have made it easier?


Yes, probably. Also faster and more flexible and subject to future enhancements.

If you want to stick with your TDS model, you will need to make RECORD4 a *child* of RECORD3, not a peer.
Back to top
View user's profile Send private message
nemani
PostPosted: Fri May 08, 2015 12:39 pm    Post subject: Need help with record repetition in message sets Reply with quote

Newbie

Joined: 21 Nov 2014
Posts: 5

Thanks for such a quick reply!

I remember trying it too.. might not have used right configurations/combinations ...but will try it again...


Can RECORD4 be configured to have max occurs as -1 OR should I create ITEMS after the last child of RECROD3 and have ITEMS have max occurs as '-1'?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri May 08, 2015 12:51 pm    Post subject: Re: Need help with record repetition in message sets Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

nemani wrote:
Thanks for such a quick reply!

I remember trying it too.. might not have used right configurations/combinations ...but will try it again...


Can RECORD4 be configured to have max occurs as -1 OR should I create ITEMS after the last child of RECROD3 and have ITEMS have max occurs as '-1'?


You should have a structure like
Code:
MESSAGE
    HEADER
    RECORD1
    RECORD2
    RECORD3 -(repeats as many times as allowed)
        RECORD4 -(repeats as many times as allowed)
    RECORD5
    END

And you need to make sure that the parser can distinguish record1 from record2, and more importantly it can distinguish the last RECORD4 before the next RECORD3, and likewise from RECORD5.

Hopefully, if you are using TDS, then each HEADER, RECORD, and END start with a tag.
Back to top
View user's profile Send private message
kimbert
PostPosted: Sat May 09, 2015 2:16 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
RECORD3 itself is not repetitive. But the combination for RECORD3 and RECORD4 is.

I think you need to use a sequence group for this:
Code:
Message
    Record1
    Record2
    sequence group maxOccurs=unbounded
        Record3  maxOccurs=1
        Record4  maxOccurs=unbounded


You could do the same in DFDL, but you would need to replace the sequence group with an element ( because DFDL does not allow a sequence group to have maxOccurs >1 )
_________________
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
nemani
PostPosted: Sat May 09, 2015 9:04 pm    Post subject: Reply with quote

Newbie

Joined: 21 Nov 2014
Posts: 5

Now I build the following structure


HDR
RECORD1
RECORD2
ORDERS (sequence group, min 1, max occurs = -1)
RECORD3 (max occurs 1)
RECORD4 (max occurs -1)
END
I have the following code to populate

while (...)

SET OutputRoot.MRM.MESSAGE.ORDES[Ix].RECORD3.FIELD1 ='AA';
...

SET OutputRoot.MRM.MESSAGE.ORDES[Ix].RECORD4[Iy].FIELD1 ='BB';
...


with one record, it works fine. However, with two records it throws :




( ['MQROOT' : 0x7f7674218970]
(0x01000000:Name):RecoverableException = (
(0x03000000:NameValue):File = '/build/slot1/S900_P/src/DataFlowEngine/MessageServices/ImbDataFlowNode.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 1155 (INTEGER)
(0x03000000:NameValue):Function = 'ImbDataFlowNode::createExceptionList' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmComputeNode' (CHARACTER)
(0x03000000:NameValue):Name = 'MsgConverter#FCMComposite_1_4' (CHARACTER)
(0x03000000:NameValue):Label = 'MsgConverter.BuildMsg' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2230 (INTEGER)
(0x03000000:NameValue):Text = 'Node throwing exception' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 14 (INTEGER)
(0x03000000:NameValue):Text = 'MsgConverter.BuildMsg' (CHARACTER)
)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = '/build/slot1/S900_P/src/DataFlowEngine/ImbRdl/ImbRdlStatementGroup.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 666 (INTEGER)
(0x03000000:NameValue):Function = 'SqlStatementGroup::execute' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmComputeNode' (CHARACTER)
(0x03000000:NameValue):Name = 'MsgConverter#FCMComposite_1_4' (CHARACTER)
(0x03000000:NameValue):Label = 'MsgConverter.BuildMsg' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2488 (INTEGER)
(0x03000000:NameValue):Text = 'Error detected, rethrowing' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '.MsgConverter_BuildMsg.Main' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '224.4' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'SET OutputRoot.MRM.ORDERS[Ix].RECORD4[Iy].FIELD1 = 'BB';' (CHARACTER)
)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = '/build/slot1/S900_P/src/DataFlowEngine/ImbRdl/ImbRdlFieldRef.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 2176 (INTEGER)
(0x03000000:NameValue):Function = 'SqlFieldReference::navigateAbsoluteToParentOfFirst' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmComputeNode' (CHARACTER)
(0x03000000:NameValue):Name = 'MsgConverter#FCMComposite_1_4' (CHARACTER)
(0x03000000:NameValue):Label = 'MsgConverter.BuildMsg' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2498 (INTEGER)
(0x03000000:NameValue):Text = 'Navigation error' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '.MsgConverter_BuildMsg.Main' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '224.8' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '4' (CHARACTER)
)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = '/build/slot1/S900_P/src/DataFlowEngine/ImbRdl/ImbRdlFieldRef.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 1048 (INTEGER)
(0x03000000:NameValue):Function = 'SqlPathElement::navigateCursorFirst' (CHARACTER)
(0x03000000:NameValue):Type = '' (CHARACTER)
(0x03000000:NameValue):Name = '' (CHARACTER)
(0x03000000:NameValue):Label = '' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2436 (INTEGER)
(0x03000000:NameValue):Text = 'Array subscript error' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '2' (CHARACTER)
)
)
)
)
)
)
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sat May 09, 2015 10:01 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

nemani wrote:

I have the following code to populate

while (...)

SET OutputRoot.MRM.MESSAGE.ORDES[Ix].RECORD3.FIELD1 ='AA';
...

SET OutputRoot.MRM.MESSAGE.ORDES[Ix].RECORD4[Iy].FIELD1 ='BB';
...


(0x03000000:NameValue):Text = 'Array subscript error' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '2' (CHARACTER)


a few points

1)Why are you using the MRM Parser on Output? did you not heed the advice given and that the whole thing would be easier using DFDL?

2) the error seems to indicate that there aren't the number of elements in the tree that you think there are.
This post http://www.mqseries.net/phpBB2/viewtopic.php?t=70105 may give you some hints of traversing and extracting a number of elements from a tree with a variable size.

3) have you put a trace node before the compute node and examined the output to see if the tree is actually has the structure you think it has?

4) a lot of useful information can be gleaned from looking at the UserTrace output that may not be visible when using the debugger. Give it a try and add this tool to your library.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
nemani
PostPosted: Sat May 09, 2015 10:41 pm    Post subject: Reply with quote

Newbie

Joined: 21 Nov 2014
Posts: 5

Thank you mqjeff, smdavies99 and kimbert for your advise.

I got it working now.

smdavies99: When I started reading about the message sets stuff, I got cwf and TDS and the documentation said for CBL, it is recommended to use TDS. I had all the records defined and got the stuff working and this new additional requirement (to have repetitive RECORD4) got me retouch the code. For another message flow,I had DFDL parser. Thanks again for your advise.

The exception was a mistake on the code side and it was fixed.

Thanks again guys!
Back to top
View user's profile Send private message
dragonMastar
PostPosted: Sun May 31, 2015 2:02 am    Post subject: Reply with quote

Newbie

Joined: 27 Apr 2015
Posts: 9

What was the code error can we know? Root Tag mapping problem?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun May 31, 2015 3:55 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

dragonMastar wrote:
What was the code error can we know? Root Tag mapping problem?

I thought the error code had made that clear: Array subscript error...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Need help with record repetition in message sets
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.