Author |
Message
|
Broker |
Posted: Mon Mar 19, 2012 10:46 am Post subject: Problem with TDS message set |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
Hello,
I am trying to build a message set for a message of format(each record is exactly of length 94)
header staring with 1 (length 94)
header staring with 5 (length 94)
Multiple Bodies starting with 627 (length 94)
Multiple Bodies starting with 637 (length 94)
Trailer starting with 622 (length 94)
trailer starting with 8 (length 94)
trailer starting with 9 (length 94)
trailer starting with 999 (length 94)
Sample:
101 11100......
5200..............
6271..............
6271..............
6371..............
6371..............
6221..............
8200..............
9000..............
99999............
For this I created a message set in TDS CSV
Message........................is of type..........Message Type
Localelement........................is of type..........Localelement Type
Local element 2 ........................is of type..........Local element 2 Type
I created a message having Properties:
DataElement Seperation: Tagged Delimited
Group Indicator:
Group Terminator:
Delimiter :<LF>
Length of Tag:1
Under this I created Local elements with corresponding types having properties:
DataElement Seperation: Fixed Length
(as each record(local element) has multiple fields in it which are of fixed lengths)
Now the problem is that, for differentiating the body 627,body 637 and trailer 622 as all start with tag 6.I am not sure how do I differentiate this values. Even the trailer starting with the 622 and body 637 are also assigned as an body 627. I tried giving the data pattern but does not work.
I would be glad if anyone can help me with this.
Thanks in advance
Broker
 |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 19, 2012 10:51 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So you have nested choices.
You have an outer choice, with a tag length of 1.
Some of those tagged elements have an inner choice, with a tag length of 2.
So you'd have the element for tag 6 contain a choice that had tags for 22, 27, 37. Or you could use group indicators with optional occurrences, that should allow you to say that 22 has to come after 27 and 37. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 19, 2012 10:52 am Post subject: Re: Problem with TDS message set |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Broker wrote: |
I tried giving the data pattern but does not work. |
What data pattern(s) did you specify? Can you be a bit for specific than "does not work"?
It looks a lot like your tag is really 3 characters long:
Header: 1 or 5 followed by any 2 characters
Body: 627 or 637
Trailer: 622 or 8 followed by any 2 characters or 9 followed by any 2 characters _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Broker |
Posted: Mon Mar 19, 2012 10:57 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
Thanks for your reply.I tried doing this way but while assigning my input body values to the output I need to loop through the number of times the body (body627 and body637) occurs in the message.
In our case, we get our output something like this(say we took the outer choice named field)
field
body627
.
.
.
field
body637
.
.
field
body 622
Now how do I count the number of times the body occurs.
Thanks
Broker |
|
Back to top |
|
 |
Broker |
Posted: Mon Mar 19, 2012 10:59 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
and we cant consider the second case as my input is SAP generated and it always has 622 trailer after body. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 19, 2012 11:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Broker wrote: |
and we cant consider the second case as my input is SAP generated and it always has 622 trailer after body. |
Why not? What's that got to do with anything? Of course a 622 trailer comes after the body, all trailers do. What am I missing?
If this is SAP generated, are you using an adapter or any of the generated SAP objects? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Broker |
Posted: Mon Mar 19, 2012 11:07 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
Sorry for that.
I gave data patterns as specified below:
header staring with 1
[1]{1}.{93}
header staring with 5
[5]{1}.{93}
Multiple Bodies starting with 627
([6]{1}([^3]{2,3}[7]{3,4}.{91})
Multiple Bodies starting with 637
([6]{1}([^2]{2,3}[7]{3,4})|([3]{2,3}[7]{3,4})|([^2]{2,3}[^2]{3,4}).{91})
Trailer starting with 622
([6]{1}([^2]{2,3}[^7]{3,4})|([^3]{2,3}[^7]{3,4})|([2]{2,3}[2]{3,4}).{91})
trailer starting with 8
[8]{1}.{93}
trailer starting with 9
[9]{1}.{93}
trailer starting with 999
[9]{93}
This is the first time I am writing a data pattern I am not sure if it is right.
Thanks
Broker |
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 19, 2012 11:07 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Broker wrote: |
Now how do I count the number of times the body occurs. |
By counting the number of times that type occurs in the message tree? Unless this is being presented as a series of records, in which case you count how many times the body occurs between header & trailer. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 19, 2012 11:10 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Broker wrote: |
This is the first time I am writing a data pattern I am not sure if it is right. |
It's not.
You need to seriously review some Internet documentation on this. Aside from being right or wrong, those patterns are unreadably messy. _________________ Honesty is the best policy.
Insanity is the best defence.
Last edited by Vitor on Mon Mar 19, 2012 11:12 am; edited 1 time in total |
|
Back to top |
|
 |
Broker |
Posted: Mon Mar 19, 2012 11:12 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
In my case If i have to count the number of times the body 27 and body 37 occur in field.How do I do that? |
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 19, 2012 11:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Broker wrote: |
In my case If i have to count the number of times the body 27 and body 37 occur in field.How do I do that? |
Using code.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 19, 2012 11:13 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
Last edited by Vitor on Mon Mar 19, 2012 2:12 pm; edited 1 time in total |
You got in before I could respond. |
|
Back to top |
|
 |
Broker |
Posted: Mon Mar 19, 2012 11:13 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
Can You please give me an example of how do I write a data pattern for body 627? |
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 19, 2012 11:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Also bear in mind that even if you get a data pattern that works, it's the slowest kind of parsing / identification & should be used only when all else has failed. I'd seriously consider the suggestion of my most worthy associate, using choices as he & I have indicated.
You've not answered my SAP questions. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 19, 2012 11:15 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Vitor wrote: |
Last edited by Vitor on Mon Mar 19, 2012 2:12 pm; edited 1 time in total |
You got in before I could respond. |
I'm fast. Sometimes too fast for my brain.
Thankfully my post-pushing-submit "you just typed utter rubbish you idiot" detector is quite good.
Though as regular readers will know, not infallible.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|