|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to setup recurring groups in Message set types |
« View previous topic :: View next topic » |
Author |
Message
|
mnath |
Posted: Tue Jul 15, 2003 11:09 am Post subject: How to setup recurring groups in Message set types |
|
|
Newbie
Joined: 15 Jul 2003 Posts: 1
|
HI,
I have a requirement where I need to set up a compound message type in TDS which has say following elements(all are fixed length).
A
B
C
D.......
Depending upon the value of A which is a value returned from a DB query they have to repeat that number of times. I have to seperate each group by <CR><LF>.
Can some one suggest best way of doing this. I have set up things needed for returning a single group of elements from flow but how to setup multiple groups of these elements
regards
Mnath |
|
Back to top |
|
 |
Craig B |
Posted: Wed Jul 16, 2003 4:16 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
When using the TDS physical format it is not possible to set up a repetition that is dependent on the value of a numeric value like you can with the CWF physical format. The user usually sets minOccurs and maxOccurs values and these are used to constrain the number of repetitions such that the number of repetitions parsed will be a value between min and maxOccurs. The TDS parser then relies on the presence of "markup" (such as delimiters etc ) to know when a repeating element has completed.
In your description you say that the value of element A is the value retrieved from a database so this must mean that you are creating a new MRM output message for which there could be a certain number of repeating records. Although not stated in your description, it would seem that A is not a member of the repeating group since this indicates how many repeating groups there will be. So you would expect a model where there is a single A, and then multiple repeating B,C,D elements.
If this correct then you are looking for a model like the following :
Code: |
myMessage
- elementA
- repeatingGroup
- elementB
- elementC
- elementD
|
In this elementB, elementC and elementD would be string elements which would be given their fixed lengths. elementA could be defined as an INTEGER or STRING to give the desired output in the bitstream. A compound type would have been created (say repeatingGroupType) on which the repeatingGroup compound element was based. repeatingGroupType would be defined as having a TDS Data Element separation of "Fixed Length". A compound type would have been created for the MRM message myMessage, and we will call this messageType. The compound type messageType would be created with a TDS Data Element separation of "All Elements Delimited" or "Variable Length Elements Delimited" if elementA is a fixed length element. The Delimiter would then be set to <CR><LF>. When the compound element repeatingGroup was added to the messageType compound type then the connection tab would have Repeating=Yes. This would then allow a Repeating element delimiter to be specified on the TDS tab for this compound element and this would be set to <CR><LF> as well. This gives the following definitions :
Code: |
myMessage [DES=AED, Delimiter = <CR><LF>]
- elementA {STRING/INTEGER, Length not defined}
- repeatingGroup [DES=FL] {Repeat=YES, RED=<CR><LF>
- elementB {STRING/INTEGER, Length Set on TDS tab}
- elementC {STRING/INTEGER, Length Set on TDS tab}
- elementD {STRING/INTEGER, Length Set on TDS tab}
|
where DES=Data Element Separation, AED=All Elements Delimited, FL=Fixed Length, and [] denote compound type details, {} = element details within compound type.
If elementA needed a fixed length and you did not want a <CR><LF> after this element then you would do the following :
Code: |
myMessage [DES=VED, Delimiter = <CR><LF>]
- elementA {STRING/INTEGER, Length Set on TDS tab}
- repeatingGroup [DES=FL] {Repeat=YES, RED=<CR><LF>
- elementB {STRING/INTEGER, Length Set on TDS tab}
- elementC {STRING/INTEGER, Length Set on TDS tab}
- elementD {STRING/INTEGER, Length Set on TDS tab}
|
where VED = Variable Length Elements Delimited.
For these definitions you would then create ESQL similar to the following :
Code: |
SET OutputRoot.MRM.elementA = 2;
SET OutputRoot.MRM.repeatingGroup[1].elementB = 'Value1';
SET OutputRoot.MRM.repeatingGroup[1].elementC = 'Value2';
SET OutputRoot.MRM.repeatingGroup[1].elementD = 'Value3';
SET OutputRoot.MRM.repeatingGroup[2].elementB = 'Value4';
SET OutputRoot.MRM.repeatingGroup[2].elementC = 'Value5';
SET OutputRoot.MRM.repeatingGroup[2].elementD = 'Value6';
|
As previously stated, the value of 2 in elementA is not used by the TDS parser/writer, but this will put this in the bitstream for any legacy application that may be receiving the message of this structure.
Hope this helps. _________________ Regards
Craig |
|
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
|
|
|
|