Author |
Message
|
dhireng |
Posted: Thu Jun 16, 2011 12:18 pm Post subject: TDS reserved Character |
|
|
Apprentice
Joined: 13 Jun 2011 Posts: 45
|
A newbee question .... I have a fixed length file delimited by || (two pipes). And I have a release character !. If || is specified as reserved character, each | is released with a !. The question is how would I release only if || appears in the elements? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 16, 2011 12:55 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I don't think the TDS parser can handle that scenario.
If you describe your data format in more detail I may be able to suggest a workaround. |
|
Back to top |
|
 |
dhireng |
Posted: Fri Jun 17, 2011 12:49 am Post subject: |
|
|
Apprentice
Joined: 13 Jun 2011 Posts: 45
|
Thanks for your quick reply... We are moving from our IBM WTX event server environment to WMB. Our TX maps receive header information as follows
HDR||aaaa||bbbb||xxxx||||||2||fdfdf||<CR><LF>
Rarely data can also have || in which case TX releases it with ! (|||||| because some elements are empty).
I'm defining a collection before I call TX.
So I defined my initiator as HDR|| , delimiter as || and release character ! but cant seem to figure out how to release ! with ||
This scenario will be extremely rare (may not have occurred even once until now) but I'm trying to do a like for like message set so that our current TX maps wont have to undergo a change.
Any pointers regarding this will help.
Cheers. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Jun 17, 2011 5:54 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK - the conclusions are:
- TDS only escapes single characters. There is no way to prevent the TDS parser adding that second ! to escape the second |.
- You cannot fix this up after TDS has written the output message. If you try, you will end up replacing a valid !|!| with !||.
So the solution is to perform the escaping before the message gets written.
- remove the escape character from the message set ( only for writing - it is still useful when parsing )
- write some ESQL ( or Java ) that performs the escaping before the message is written. The algorithm would be:
Code: |
for each field
replace every occurrence of '||' with '"!||' |
ESQL has a handy function for replacing one substring with another throughout a string:
Code: |
SET myFieldRef VALUE = REPLACE(FIELDVALUE(myFieldRef), '||','!||') ; |
|
|
Back to top |
|
 |
dhireng |
Posted: Fri Jun 17, 2011 1:55 pm Post subject: |
|
|
Apprentice
Joined: 13 Jun 2011 Posts: 45
|
Thanks for the confirmation that I cannot do anything with my message set definition. |
|
Back to top |
|
 |
|