Author |
Message
|
pcelari |
Posted: Tue Apr 20, 2010 5:38 am Post subject: Why is fixed length field not enforced? |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Hello,
I have a messgeset defined with both XML and binary formats, for easy transformation between implementations.
The binary format of all fields are fixed length string. I anticipate if the XML field text is larger than the fixed length specified in the messageset, upon parsing to binary format, the fields that exceed the length would be automatically truncated.
But it didn't. instead, result in field overflow upon parsing.
I feel I must have missed sth, but can't say exactly what. Can anyone please point out what I need to do to force the enforcement of the fixed-length?
thanks a lot for sharing your insight!
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
Missam |
Posted: Tue Apr 20, 2010 6:02 am Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
How is your entire message defined?
Is it a fixed length?
Because when ever your message element overflows. it will overflow to the next adjacent element and affect all the elements afterwards.
you can put a trace and see how your elements are displayed and the overflow one too. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 20, 2010 7:00 am Post subject: Re: Why is fixed length field not enforced? |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
pcelari wrote: |
I anticipate if the XML field text is larger than the fixed length specified in the messageset, upon parsing to binary format, the fields that exceed the length would be automatically truncated. |
Why did you anticipate that? I would have anticipated exactly what you've experienced.
How are you mapping between formats? Enforcement code needs to be placed there. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Apr 20, 2010 7:43 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You don't say what type of physical format you are using for your 'binary' format (TDS or CWF ). However, both of those physical formats have an option to truncate fixed-length strings on output.
Check out the infocenter, or take a look through the message set options ( the ones which apply to the entire message set ). |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 20, 2010 8:10 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
However, both of those physical formats have an option to truncate fixed-length strings on output. |
So I've learned something!  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
pcelari |
Posted: Tue Apr 20, 2010 11:03 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Hi Kimbert,
Thank you so much for sharing this. I found it, under messageSet.mset properties, Output settings.
With this, I would save a lot of coding with substring() functions.
again, many thanks!
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
|