Page 1 of 1

Comma delimited to fixed width flat file.

Posted: Thu Nov 06, 2008 2:30 am
by jaysheel
Hi,

I have a requirement of converting a comma delimited flat file to a fixed width flat file.

The data in the comma delimited flat file looks something like this.

1,CSB01B,7.4,SEA01T,8.4,S1A01R,9.4
2,MUP01C,10.4,FSC01Z,11.4,CDE01F,12.4


I want the data to be in fixed width columns in the target flat file, something like below.

1 CSB01B 7.4 SEA01T 8.4 S1A01R 9.4
2 MUP01C 10.4 FSC01Z 11.4 CDE01F 12.4

Could any one please guide me on this..


Thanks in Advance.

Re: Comma delimited to fixed width flat file.

Posted: Thu Nov 06, 2008 5:50 am
by mousazzi
If I understand the problem, have you tried to use the function Ereplace(String,',',' ') ? The data 7.4 must be converted to 'blank'||7.4 or 'blank'||'blank'||7.4

Posted: Thu Nov 06, 2008 5:56 am
by jaysheel
No. This has nothing to do with the transformer derivation.
I have a flat file which is comma delimited. The target must be of fixed width column thats all.

Posted: Thu Nov 06, 2008 7:12 am
by ray.wurlod
Read the file as comma delimited.

Write the file as fixed width format. The display width will be the width of each column in the written file.

Put a Transformer stage between the two Sequential File stages so that you can have links with different format properties.

Posted: Thu Nov 06, 2008 7:59 am
by chulett
Exactly. Simply note the type in each Sequential File stage. And, as Ray notes, understand that the Display size controls the fixed-width column size.