Integers in fixedWidthfile

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Integers in fixedWidthfile

Post by dodda »

Hello

I have fixed with file as source in which there were couple of fields which were defined as Integer datatypes and right justified with leading spaces. Is it a common practice to have integer values as right justified. If i want to make the integers as left justified in the target file, is there a function in the transfomer that i can use?

Appreciate your help

Regards
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Justification only applies to text fields. In order to left just try:

Code: Select all

Right(Space(MaxLen):TRIM(In.column),MaxLen
where MaxLen is the length of your left-padded string and In.Column is the text right-padded input column.
Raamc
Premium Member
Premium Member
Posts: 87
Joined: Mon Aug 20, 2007 9:08 am

Post by Raamc »

You can also use the following code..
Space(maxlength-Trim(In.column)):In.column
:wink:
Thanks,
Raamc
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It IS common practice that integers are right justified, sometimes left padded with space, sometimes left padded with zeroes.

You can handle it easily with Trim().
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