ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » CSV and field lengths

Post new topic  Reply to topic
 CSV and field lengths « View previous topic :: View next topic » 
Author Message
murdeep
PostPosted: Tue Jun 12, 2012 6:24 am    Post subject: CSV and field lengths Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

Quick question that I think I already know the answer for after reading the doc.

I have modelled a pipe delimited record and it parses no problems. Now I want to take it one step further and impose field lengths so that I can have the parser throw an exception that a field is too long before I do a database insert.

My testing shows that setting the string length on my type definition doesn't force the MRM to reject the record if the data exceeds the length.

The doc seems to indicate that I can have delimited variable length but if I specify the length the data must be padded to the length which will not be the case with my data. Here's a quote from the doc:

Quote:
Variable Length Elements Delimited
In a complex type with Variable Length Elements Delimited separation, some elements are determined by their length, and other elements are delimited. This combination of a delimited and a fixed-length format follows rules that are associated with both formats. Lengths can be given and used, but they are not mandatory.
If a length is present for a textual element, it is used, and a delimiter is not needed to terminate that element. The element must be padded to the correct length, and cannot exceed that length.
If no length is given for a textual element, the delimiter is required.
For non-textual elements, the length is determined by the Physical Type of the element. See MRM TDS format: Determining the length of simple data values.
A complex type with Variable Length Elements Delimited separation that contains only variable length elements resembles a complex type with All Elements Delimited separation. If it contains only fixed-length elements, it resembles a Fixed Length type.



So is it possible to have delimited fields that can vary in length but not exceed a specific length and don't have to be padded?

Regards
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue Jun 12, 2012 6:27 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

One way to limit string length is to use the SUBSTRING function.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Tue Jun 12, 2012 6:29 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

The MRM parser behaves like an XML parser. If it can parse the data then it will, regardless of the facets in the schema. If you want it to strictly validate against the min/maxOccurs and facets in the xsd then you can do that by setting 'Validation' to 'Content and Value'.
Back to top
View user's profile Send private message
murdeep
PostPosted: Tue Jun 12, 2012 9:44 am    Post subject: Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

Thanks for the replies.

During some more experimenting I saw that when I define my complex type as "All Elements Delimited" that a check box named "Observe Element Length" was made available and when I check it it causes the parser to enforce the length I specify when defining local elements. So I think this is what I want.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jun 12, 2012 11:38 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Yes, the 'Observe element length' property will meet your requirements.

Please note, though, that 'Observe element length' property does *not* make the parser validate all of the facets ( Value Constraints ) in the message definition. If you want that, you must set Validation to 'Content and Value'.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » CSV and field lengths
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.