how to create fixed width text file

This forum contains ProfileStage posts and now focuses at newer versions Infosphere Information Analyzer.

Moderators: chulett, rschirm

Post Reply
developeretl
Participant
Posts: 89
Joined: Sat Jul 24, 2010 11:33 pm

how to create fixed width text file

Post by developeretl »

Hi ,
I need to create fixed width text file in the target. From source im getting csv file. From source data is in varchar and in target they are in char type. I want to have fixed width file in the target directory. If the length is 10 and data is of length 5 then it should add 5 zero's or add space to make it length 10. For numeric type when I have applied the logic it is working out ie....changing the target sql type to char. But it im not seeing this true for char type. Can anyone please tell me how to achieve this ?

Example: target lenth 10
Source : "1234"
Target : " 0000001234"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As I'm assuming this has nothing to do with ProfileStage or IA, please repost this in the proper forum - the Enterprise Edition forum.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ramsnaraboina
Participant
Posts: 10
Joined: Wed Jan 26, 2011 8:09 am
Location: Hyderbad

Re: how to create fixed width text file

Post by ramsnaraboina »

Hi from my Analysis Info Analyzer, we dont achive these situation
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

With Information Analyzer you get the reports it gives you. You can use DataStage subsequently if you don't like the format.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
deeplind07
Participant
Posts: 31
Joined: Mon Jun 28, 2010 5:15 am
Location: pune

Post by deeplind07 »

you can use LPAD funciton to pad leading zeroes by mentioning the target length.(dont forget to add trim function for the input column)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

deeplind07 wrote:you can use LPAD funciton to pad leading zeroes by mentioning the target length.(dont forget to add trim function for the input column)
In Information Analyzer? Where?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
deeplind07
Participant
Posts: 31
Joined: Mon Jun 28, 2010 5:15 am
Location: pune

Post by deeplind07 »

I am sorry i was talking about trasforemer stage..
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

deeplind07 wrote:I am sorry i was talking about trasforemer stage..
What about Right() or Left()?
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no Transformer stage in Information Analyzer. I repeat that the requirement must be solved by post-processing the Information Analyzer report using a DataStage job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply