One Star

tMap not preserving field lengths

Running in TOS v4.2.2
OS = Windows Server Enterprise 2007
I have a tFileInputDelimited on the left, and a tFileOutputPositional on the right. When the data length in a (delimited) field from the input exceeds the destination field length, it is not truncated (as it should be), it's brought over intact, which mis-aligns everything else in the output record from that point onward.
I've tried defining field lengths in the delimited (input) side of the tMap, to match field lengths on the output, to no avail.
6 REPLIES
One Star

Re: tMap not preserving field lengths

I haven't gotten any response on this, it's affecting our production. Could I please get any helpful suggestions on this? Am I missing something obvious as to why this is/might be happening?
Thanks
One Star

Re: tMap not preserving field lengths

You will need to do the truncation as part of the map rule. Use the LEFT function.
One Star

Re: tMap not preserving field lengths

That means, to safeguard my output, I'll have to manually truncate the input for every target field when using a tMap like this. That seems like a pretty serious TOS design flaw. Why bother specifying field lengths for tFileOutputPositional schemas if the runtime is going to ignore them by default when populating the fields? It's not exactly an improvement in developer productivity.
Not to mention, will using the LEFT function like that cause StringIndexOutOfBoundsExceptions when the data is less than the maximum target length?
One Star

Re: tMap not preserving field lengths

In tFileOutputPosition you should have the option "keep" for columns, you should change it to "left".
Or you could use a tSchemaComplianceCheck component. No need to do it all for yourself in a tMap, except if you have many columns - a tSchemaComplianceCheck then easy busts the 65k byte of a method.
One Star

Re: tMap not preserving field lengths

Sorry forgot about that. I was thinking around tFileOutputDelimited
One Star

Re: tMap not preserving field lengths

OK, so it was right under my nose, which explains why I missed it. Changing the Keep setting for every target column from All to Left did the trick.
Thanks