Comma delimited to fixed width flat file.

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
jaysheel
Participant
Posts: 57
Joined: Mon Apr 07, 2008 1:54 am
Location: Bangalore

Comma delimited to fixed width flat file.

Post 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.
- Jaysheel -
mousazzi
Participant
Posts: 18
Joined: Thu Nov 23, 2006 3:56 am

Re: Comma delimited to fixed width flat file.

Post 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
jaysheel
Participant
Posts: 57
Joined: Mon Apr 07, 2008 1:54 am
Location: Bangalore

Post 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.
- Jaysheel -
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply