Author |
Message
|
maxis |
Posted: Mon Oct 10, 2005 12:43 am Post subject: dynamic length of the record |
|
|
Centurion
Joined: 25 Jun 2002 Posts: 144
|
Is the following scenario possible .. if yes .. then "how"
Can a record in Message Broker V5.0 be repetable dynamically ?. For example, lets say record size if 10 bytes and gets a message of 20 bytes, then it should be repeated 2 times, if N (mulitple of 10) bytes of messages comes then it should be repeated N times ?.
Is the above scenario possible without using int variable, which would detect the N times, during the run time ?
thanks for your input ...
M |
|
Back to top |
|
 |
elvis_gn |
Posted: Mon Oct 10, 2005 2:22 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
What ur asking is if it is possible to have a block of fields repeatable...??
i.e
<Name>
<FirstName></FirstName>
<LastName></LastName>
</Name>
<Name>
<FirstName></FirstName>
<LastName></LastName>
</Name>
<Name>
<FirstName></FirstName>
<LastName></LastName>
</Name>.............
...................
So when you find one segemnt to be 10 bytes...any multiple of 10bytes will be the dynamic number of occurances of this segment.....Am i right in understanding you....
If yes, then create a complex type say "Name" in Types and add the simple field references under it and give its max occurs as some huge number which can be the max limit you want for the occurances or -1....
Also, if this is the doubt you had, then you need to refer the *Basics*.pdf |
|
Back to top |
|
 |
kimbert |
Posted: Mon Oct 10, 2005 2:38 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Elvis: I don't think pmvk is using XML
pmvk: You don't say what your input message looks like. I presume it is a COBOL or C-style message. You also did not state whether you are using the MRM domain ( I presume you are ) and what your input format is ( although I 'm guessing that it is CWF).
If you answer the above questions, I may be able to suggest a way forward. |
|
Back to top |
|
 |
maxis |
Posted: Mon Oct 10, 2005 2:46 am Post subject: |
|
|
Centurion
Joined: 25 Jun 2002 Posts: 144
|
hi Kimbert,
yes .. youre right in understanding ....
am using MRM and the input format is CWF. Here is the sample message
filed1field2<<field3-1>><<field3-2>>....<<field3-n>>
Note that field1 and field2 can be simple types or compound type. There wont be any indication about the number of occurence of <<field3>>, which will be determined only at the run time ...
does that help in giving suggestion .. ? .. if not pl let me know .. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Oct 10, 2005 3:10 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK - that's what I thought, but I wanted to check.
Basically, you have a field which repeats until the end of the bitstream. WBI-MB v6.0 has support for this, but you're using v5, so you will have to write some ESQL to direct the parse.
1. Parse the message as a BLOB
2. Calculate the number of repeats based on the size of the input message.
3. Add the number of repeats to the front of the BLOB (i.e. create yourself a Repeat Count field)
4. Re-parse the BLOB against an MRM CWF message definition which uses the Repeat Count field.
Future readers of this post: if you have a non-fixed-length header, this technique will not work. You have to model the header using a CWF message, and add a binary field to the end with its length units set to 'End Of Bitstream'. Then you have to re-parse the binary field as described above. |
|
Back to top |
|
 |
maxis |
Posted: Mon Oct 10, 2005 3:27 am Post subject: |
|
|
Centurion
Joined: 25 Jun 2002 Posts: 144
|
Thanks Kimbert for that useful suggestion.
So basically we've add another field and will have to remove it before sending it, if the receiving legacy applications doesnt expect the Repeat count field.
In MB V5.0 we cannt have the dynamic length, if there is a requirement, then will have to adopt your idea ..
thanks again .. |
|
Back to top |
|
 |
|