Author |
Message
|
pawel_janowski |
Posted: Tue Nov 09, 2010 6:47 am Post subject: Parsing input as TDS |
|
|
Apprentice
Joined: 13 Dec 2006 Posts: 38
|
Hi!
I've got the problem with parsing input messages of the following format:
- each message consist of one or more segments and each segment starts with segment indicator of form @5000, with assigned value "#"
and the there is a @5001 field with a value indicating a segment type
- each segment consists of one or more fields and each field consists of field indicator of form @<xxxx>, where <xxxx> is exactly four digit number
The structure of segments is quite flat - the segment definition cannot contain any other segments.
Example:
Code: |
@5000:#@5001:SEGTYPE1@5002:ABC@5005:000@1020:0101@5000:#@5001:SEGTYPE2@1232:VALUE |
I'd like to parse the message as a TDS and obtain the tree-like structure consisting of a number of segments, sth like this:
Code: |
<Message>
<segment1>
<f2>ABC</f2>
<f5>000</f5>
<f10>0101</f10>
</segment1>
<segment2>
<f12>VALUE</f12>
</segment2>
</Message> |
I tried many combinations of tags, delimiters and so on defining MRM (wtih TDS as physical representation) and all my attepmts failed.
What is (possible the best) way to achieve the goal? Any help will be appreciated.
Pawel Janowski _________________ Pawel Janowski |
|
Back to top |
|
 |
Vitor |
Posted: Tue Nov 09, 2010 7:04 am Post subject: Re: Parsing input as TDS |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
pawel_janowski wrote: |
I tried many combinations of tags, delimiters and so on defining MRM (wtih TDS as physical representation) and all my attepmts failed. |
Accepting that kimbert will be along in a minute, can you post some examples for what you've tried. The description you've given seems to be a fairly straightforward TDS sort of thing & I'm interested to see where you've hit problems (and indeed what problems).
It will also prevent us suggesting obvious solutions that you've already attempted unsuccessfully. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 09, 2010 7:05 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 09, 2010 11:08 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
...a bit more than a minute. The day job got in the way.
I'll wait for some details on what pawel_janowski has tried before offering advice - no point in telling him what he knows already. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Nov 09, 2010 11:27 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
The day job got in the way. |
It's a pain when that happens isn't it?  _________________ Honesty is the best policy.
Insanity is the best defence.
Last edited by Vitor on Wed Nov 10, 2010 4:57 am; edited 2 times in total |
|
Back to top |
|
 |
pawel_janowski |
Posted: Wed Nov 10, 2010 4:34 am Post subject: |
|
|
Apprentice
Joined: 13 Dec 2006 Posts: 38
|
OK. So my problem identification and more details as needed:
1) The problem - there is no difference between segment and field separators - they are of the same form, so parsing the segment broker cannot state that @5000 is actually an indicator of a new segment but not a new field
I tried to use @5000:#@5001:SEGTYPE1 (for the complex type defining segment of the type SEGTYPE1) and some variations of that (eg. with @ at the end).
I tried to define the global complex type with 'Use data pattern' as data element separation.
And many many - it took me two days of tests so it is not esay to describe and I think it is not worth of it, because nothing worked.
But it was always the same - the parser cannot state, when the new segment start and tries to parse a segment indicator as a field indicator.
Regards,
Pawel _________________ Pawel Janowski |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Nov 10, 2010 4:48 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Again, this appears to be tagged/fixed length messaging. No need for Data Patterns.
You say that @5000 is both a tag for a segment and a tag for a field?
You should be able to use it as a group indicator for the segment and a tag on an element inside the group. |
|
Back to top |
|
 |
|