Author |
Message
|
martinrydman |
Posted: Wed May 25, 2005 1:53 am Post subject: MRM modelling challange |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
Hi all,
I need to model this structure:
Code: |
Msg
Batch (*)
Header record (1)
Detail record (*)
EOF Record (1)
|
Now, the tricky part is that the Header and EOF record has a unique tag, but the Detail record does not. My hunch is that I should somehow use Groups, but the darn documentation on MRM modelling is not exactly a case study in lucidity
Any hints or help appreciated!
/Martin |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed May 25, 2005 3:10 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
How do you know the detail record doesn't have a unique tag? What is the first field of the detail record?
You probably don't need one, though.
Model the header and footer using tags. Include a repeating min occurs 1 element of a complex type that represents the detail record as the last element of the header.
Code: |
Msg
Batch(*)
Header Record(1)
Detail Record
EOF Record
|
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Wed May 25, 2005 3:12 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
the darn documentation on MRM modelling is not exactly a case study in lucidity |
Hmmm, whatever can he mean...?
I need a bit more info before I can help. First off, it's always worth stating which version and CSD level you're on - it often makes a difference to the answer.
It would also be useful to know a bit more about the message structure. Your initial post sketches out the broad picture, but with any parsing problem the devil is in the details. A sample input message is usually the best way to convey those details. You can change confidential parts before posting. |
|
Back to top |
|
 |
martinrydman |
Posted: Wed May 25, 2005 3:51 am Post subject: |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
Hi,
Quote: |
but with any parsing problem the devil is in the details |
...right!
I've constructed a simplified version of my real message so it's easier to squeeze in here.
Record def's:
Code: |
Header
------
RecIndicator X(5) '1HEAD'
Data1 X(5)
Data2 X(5)
Detail
------
Data1 X(5)
Data2 X(5)
Data3 X(5)
EOF
------
RecIndicator X(5) '1_EOF'
Data1 X(5)
Data2 X(5)
|
Data:
Code: |
1HEAD12345ABCDE
data1data2XYZVW
data3data4ABCDE
data5data6FGHIJ
1_EOF54321ZZZZZ
1HEAD99999FGHIJ
data7data8KLMNO
data9data0XXXXX
1_EOF11111YYYYY
1HEADabcdeFGHIJ
1_EOFabcdeYYYYY
|
And the overall structure (Detail changed to 0..*)
Code: |
Msg
Batch (*)
Header record (1)
Detail record (0..*)
EOF Record (1)
|
I fiddled with Jeff's suggestion, and it got slightly better, but not spot on.
/Martin |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed May 25, 2005 4:08 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You are using TDS, right?
You should be able to do what you want, using Tagged-Fixed Length, and using the model I suggested.
The detail records are always going to be fixed length chunks, right? And they will always be distinguishable from the EOF record by the EOF tag, right?
Again, the important bit of my suggestion was that Detail was a child of Header, not a sibling.
Code: |
Msg
Batch (*)
Header record (1)
Detail record (0..*)
EOF Record (1) |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
martinrydman |
Posted: Wed May 25, 2005 4:32 am Post subject: |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
Hi Jeff, and thanks for your reply!
Unfortunately, the plot thickens. I just realixed I must deal with COMP-3 packed fields also, which limits my options to CWF, I think?
If this is indeed the case, I guess I could read the message in the BLOB domain, chop it up in records, PARSE it using ESQL and PROPAGATE it downstream to do some transformations, and then collect all records and concatenate them to another BLOB using BITSTREAM.
Any more elegant suggestions?
/Martin |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed May 25, 2005 5:04 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Yes, you're limited to using CWF if you need to handle COMP fields.
What I have done in similar cases is read the message as a blob, count the repeating fields, and insert a new field that includes that count.
So
Code: |
Msg
Batch Count
Batch (*)
Header record (1)
HeaderFields
Detail Record Count
Detail record (0..*)
EOF Record (1) |
And then, if necessary, strip that back out on the output side.
With this, you won't need to model the tags, the parser will be able to handle the repeats and distinguish the diferent pieces properly. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
martinrydman |
Posted: Wed May 25, 2005 5:18 am Post subject: |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
OK, Jeff, thanks!
/Martin |
|
Back to top |
|
 |
martinrydman |
Posted: Tue Jun 28, 2005 4:13 am Post subject: |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
Hi,
I'm back with the original problem. Here's my msgset model:
Code: |
| Data Element Separation | Delimiter | Occurs | Tag | Repeating Element Delimiter
---------------+--------------------------+------------+---------+--------+-----------------------------
Msg | Tagged Delimited | <CR><LF> | | |
Batch | Tagged Delimited | <CR><LF> | 1..-1 | |
HeadGrp | All Elements Delimited | <CR><LF> | 1..1 | 1HEAD |
Head | Fixed Length | | | |
Fld1 | | | | |
Fld2 | | | | |
Details | All Elements Delimited | <CR><LF> | 1..1 | |
Detail | Fixed Length | | 0..-1 | | <CR><LF>
Fld1 | | | | |
Fld2 | | | | |
Fld3 | | | | |
EOF | All Elements Delimited | <CR><LF> | 0..1 | 1_EOF |
Fld1 | | | | |
Fld2 | | | | |
|
Here's my data:
Code: |
1HEAD12345ABCDE
data1data2XYZVW
data3data4ABCDE
data5data6FGHIJ
1_EOF54321ZZZZZ
1HEAD99999FGHIJ
data7data8KLMNO
data9data0XXXXX
1_EOF11111YYYYY
1HEADabcdeFGHIJ
1_EOFabcdeYYYYY
|
And here's my trace:
Code: |
(
(0x01000013):Batch = (
(0x01000013):HeadGrp = (
(0x01000013):Head = (
(0x0300000B):Data1 = '12345'
(0x0300000B):Data2 = 'ABCDE'
)
(0x01000013):Details = (
(0x01000013):Detail = (
(0x0300000B):Data1 = 'data1'
(0x0300000B):Data2 = 'data2'
(0x0300000B):Data3 = 'XYZVW'
)
(0x01000013):Detail = (
(0x0300000B):Data1 = 'data3'
(0x0300000B):Data2 = 'data4'
(0x0300000B):Data3 = 'ABCDE'
)
(0x01000013):Detail = (
(0x0300000B):Data1 = 'data5'
(0x0300000B):Data2 = 'data6'
(0x0300000B):Data3 = 'FGHIJ'
)
(0x01000013):Detail = (
(0x0300000B):Data1 = '1_EOF'
(0x0300000B):Data2 = '54321'
(0x0300000B):Data3 = 'ZZZZZ'
)
(0x01000013):Detail = (
(0x0300000B):Data1 = '1HEAD'
(0x0300000B):Data2 = '99999'
(0x0300000B):Data3 = 'FGHIJ'
)
(0x01000013):Detail = (
(0x0300000B):Data1 = 'data7'
(0x0300000B):Data2 = 'data8'
(0x0300000B):Data3 = 'KLMNO'
)
(0x01000013):Detail = (
(0x0300000B):Data1 = 'data9'
(0x0300000B):Data2 = 'data0'
(0x0300000B):Data3 = 'XXXXX'
)
(0x01000013):Detail = (
(0x0300000B):Data1 = '1_EOF'
(0x0300000B):Data2 = '11111'
(0x0300000B):Data3 = 'YYYYY'
)
(0x01000013):Detail = (
(0x0300000B):Data1 = '1HEAD'
(0x0300000B):Data2 = 'abcde'
(0x0300000B):Data3 = 'FGHIJ'
)
(0x01000013):Detail = (
(0x0300000B):Data1 = '1_EOF'
(0x0300000B):Data2 = 'abcde'
(0x0300000B):Data3 = 'YYYYY'
)
)
)
)
)
|
I've tried a number of combinations with the Header/Detail modelling, with and without the wrapping levels (HeadGrp and Details) but no matter what I do, it fails to find it's way back out of the structure when it runs into the '1_EOF' tag.
Any new ideas?
/Martin |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 28, 2005 4:28 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Am I wrong, or do you not have <CR><LF> in there, like you said would delimit the repeating structure? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
martinrydman |
Posted: Tue Jun 28, 2005 6:14 am Post subject: |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
yes, each line is crlf delimited
/Martin |
|
Back to top |
|
 |
martinrydman |
Posted: Wed Jun 29, 2005 9:15 am Post subject: |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
What about it guys? Can you resist the ...challange!
/Martin  |
|
Back to top |
|
 |
|