FTP Leading Zeros

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
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

FTP Leading Zeros

Post by MrBlack »

I'm using the FTP_Enterprise stage for SFTP for the first time. When my numeric columns are being sent through, the recipient is seeing leading zeros on the numbers. So the column was define Numeric 38 and my data is showing up as

Code: Select all

00000000000000000000000000000000054321
How would I remove these leading zeros from the CVS so my recipient doesn't have to?
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

It is likely related to the data type chosen rather than the FTP stage or type of transfer. Replace the FTP stage with Sequential File stage to see. Then do a search on "remove leading zero" which is a topic that has been resolved online here many times over. Resolve it prior to FTP.
Choose a job you love, and you will never have to work a day in your life. - Confucius
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's how DataStage works, and always has. It adds leading and trailing nonsignificant zeroes to the extent specified by the Precision and Scale settings. Don't worry, it's still the same number and will produce the same results in arithmetic.

You can only remove the zeroes if the target data type is string of some kind.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

As Ray has hinted at, but not explicitly stated, convert your numeric value into a string inside DataStage before writing to the CSV file, and your leading zeroes will not appear.
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

Anyway its a csv file. Why cant you define your metadata as varchar? Thats should solve your problem I guess.
Arun
naveenkumar.ssn
Participant
Posts: 36
Joined: Thu Dec 03, 2009 9:11 pm
Location: Malaysia

Re: FTP Leading Zeros

Post by naveenkumar.ssn »

hi

Cant we add a transformer and trim the leading "zeros".

Regards
Naveen
Naveen Kumar
Datastage Consultant
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not if the data type is Decimal.

Well... you can, but DataStage will reinstate them.
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