Author |
Message
|
hh |
Posted: Tue Oct 25, 2005 7:59 am Post subject: Messageset design question... |
|
|
Newbie
Joined: 25 Oct 2005 Posts: 7
|
Hi, all, I'd like to have your opinions as of how I should build a messageset since I feel a bit stumped about this one myself.
Incoming data is structured like this
1 rowtype 1:n repetitions.
First comes a number of fixed length fields (no problem here) where the last field can be of different length depending on what data comes after it.
If no data is supplied it's trimmed of spaces.
After those fields theres a group of four fields with fixed length that can occur 0-10 times but the last group will like the last field in the main group not be padded with spaces if it's the last group. All rows are terminated with <CR><LF>
No discernable tags that I can use.
So basicly a message might look like this (spaces between fields for clarification):
12345 abcd 6789 somename<CR><LF>
12345 abcd 6789 somename|paddingspaces|repeatinggroupfield1repeatinggroupfield2repeatinggroupfield3|paddingspaces|repeatinggroupfield1repeatinggroupfield2repeatinggroupfield3<CR><LF>
So, I've been looking at using tagged delimited, no luck (no usable tags).
Split into 2 groups using data pattern but I always seem to come up short
Any idea's or suggestions?
/M |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 26, 2005 1:36 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Interesting message format - I'm constantly amazed at the sheer variety of formats out there! The TDS physical format can do the job for you, but it may take a couple of tries to get it right. The basic idea is:
Message
Row All Elements Delimited, Delimiter=<CR><LF>
Header1
Header2
Header3
Name |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 26, 2005 1:49 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Please ignore the previous post - I hit 'submit' accidentally...
Interesting message format - I'm constantly amazed at the sheer variety of formats out there! The TDS physical format can do the job for you, but it may take a couple of tries to get it right. The basic idea is:
Code: |
Message
Row ALL ELEMENTS DELIMITED, Delimiter=<CR><LF>
HeaderGroup FIXED LENGTH
Header1 Length=5
Header2 Length=4
Header3 Length=4
Name
DataGroup USE DATA PATTERN
RepFields FIXED LENGTH, Data Pattern = '[^\r]15'
RepField1 Length=5
RepField2 Length=5
RepField3 Length=5
|
Where
- the '15' in the data pattern is just a guess at the total number of characters in one group of the repeating fields.
- uppercase strings are the Data Element Separation setting |
|
Back to top |
|
 |
hh |
Posted: Wed Oct 26, 2005 1:56 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2005 Posts: 7
|
Thank you for your reply
>Interesting message format - I'm constantly amazed at the sheer variety of
>formats out there! The TDS physical format can do the job for you, but it
>may take a couple of tries to get it right. The basic idea is:
Tell me about it
>Message
>Row All Elements Delimited, Delimiter=<CR><LF>
Yeah, that is what I've already done
>Header1
>Header2
>Header3
>Name
Can you elaborate on this? My problem with solving this starts with the fact that the first row will have a fixed length group IF it's followed by a repeating group and only then. The repeating group will be fixed length UNTIL the last repeating group where the last element which will not be padded. I tried
root (All Elements Delimited: Delimiter CRLF)
-record (Use Data Pattern)
-group1 (Use Data Pattern)
-group2 (Use Data Pattern, 0-10)
I can get all the way to parsing group2 (first occurence) on a regular row with paddings.
When I generate a number of rows from a compute node I only get it on the format where all elements are padded to their length or not at all.
/HH |
|
Back to top |
|
 |
hh |
Posted: Wed Oct 26, 2005 2:25 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2005 Posts: 7
|
I was too quick then  |
|
Back to top |
|
 |
hh |
Posted: Wed Oct 26, 2005 2:28 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2005 Posts: 7
|
But the header and data group is not separated with crlfs...
/HH |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 26, 2005 2:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
But the header and data group is not separated with crlfs... |
Fair comment - my attempt was a bit off-the-cuff
Quote: |
I can get all the way to parsing group2 (first occurence) on a regular row with paddings |
Can you give a bit more information about what went wrong?
Quote: |
When I generate a number of rows from a compute node I only get it on the format where all elements are padded to their length or not at all |
You may need to hand-code some ESQL to cope with this, because you cannot use Data Patterns to help with the output side. I can suggest an approach, but it depends on the version and CSD level that you are using. |
|
Back to top |
|
 |
hh |
Posted: Wed Oct 26, 2005 2:46 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2005 Posts: 7
|
Ok, well, there are 2 problems as I see it:
last element of what we discuss as header group may or may not be of a certain length depending on what comes after. Same thing with the repeating group, the last element in the last group might not contain data to the length specified hence the difference:
aaa bbb ccc|padding|repeatinggroup<CR><LF>
vs row without repeating group
aaa bbb ccc<CR><LF>
and the same goes for a row with several repeating groups:
aaa bbb ccc|padding|repeatinggroup|lastelementpadded|repeatinggroup|lastelementNOTpadded|<CR><LF>
I'm using WBIMB 5 CSD 05.
Thanks for the reply, this one really puzzles me
/HH |
|
Back to top |
|
 |
hh |
Posted: Wed Oct 26, 2005 2:50 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2005 Posts: 7
|
I'm currently looking into manually handling the repeating groups (read them as one field) which would be an ok solution in this case:
But I'm not sure as how to formulate the data pattern because of the last field in the header group.
/HH |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 01, 2005 3:41 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
hh,
Apologies for not replying - I've been off-site for a few days and without a link. Let me know if this is still causing you a problem. |
|
Back to top |
|
 |
hh |
Posted: Tue Nov 01, 2005 4:06 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2005 Posts: 7
|
Hi, thanks for it but I just got word that the input was infact fixed length. The specification had been done on a file that was sent via ftp using ascii transfer mode and thereby cutting all the spaces on the end of each line... So when getting a correct file I managed to fix everything in about an hour
Thanks for your help tho!
/HH |
|
Back to top |
|
 |
|