Originally posted by: repanzer
darakok, are you in Cambodia?!?!?
There's a few ways you can fix this.
The first solution I mentioned above, where you have a map in front of the other maps that pad the records before passing to the translation map. We used this method in my last job where files that were FTPed from the mainframe lost the training spaces in each record.
Another is to use partitioning.
In the partition, you say the record can be either of 3 formats.
Format1
File
...records(s)
....Field1 (0 min, 10 max) padded with spaces
....Field2 (0 min, 10 max) padded with spaces
....Field3 (0 min, 15 max) not paddded
Format2
File
...records(s)
....Field1 (0 min, 10 max) padded with spaces
....Field2 (0 min, 10 max) not padded
Format3
File
...records(s)
....Field1 (0 min, 10 max) not padded
The problem with this solution is you have "hundreds of maps with the spacing issue". Changing the input type tree to use partitioning will require you to update all those maps, because you need a functional map for each of the formats under the partition. So your output rule will look like this;
EITHER( f_map1(Format1), f_map2(format2), f_map3(format3)).
f_map1, f_map2, and f_map3 will need to be built.
Another is; you can define the field in the input record as just a blob of text instead of 3 fields.
File
...Records(s)
.....Blob_Of_Text(min 0, max 45)
Then in your output rules, you say;
Output_For_Field1= TRIMRIGHT( LEFT(BlobOfText, 10) ," ")
Output_For_Field2= TRIMRIGHT( MID (BlobOfText,10,20) ," ")
Output_For_Field3= TRIMRIGHT( MID (BlobOfText,30,15) ," ")
Finally, assuming that the trailing spaces are lost in the tranmission of the data, and that the customer is willing to update their system, you can ask them to put a certain character before the record terminator. This will ensure the each record is 45 bytes when you get it;
=====Column 1=====|====Column 2====|=====Column 3=====
AAAAAAAAAAAxxxxxxxBBBBBBBBxxxxxxxxxCCCCCCCxxxxxxxxxxxx&
Other then the first solution I mentioned, the other methods in this post require you to update all those hundred of maps (from what I can tell).
Putting a map in front of the translation maps that adds the trailing spaces that are lost, would probably be the best way, because you'll only have to create a new, simple map, and not change the hundreds of existing maps. I would avoid re-building teh hundreds of maps at all cost, and just build one map to fix the data coming in before it gets translated.
good luck
#IBMSterlingTransformationExtender#DataExchange#IBM-Websphere-Transformation-Extender