how to strip leading 0's from numeric data

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
tcat2000
Participant
Posts: 6
Joined: Wed Jun 01, 2005 1:35 pm

how to strip leading 0's from numeric data

Post by tcat2000 »

Hi,

does anyone know how to strip leading zeros from numeric fields.

ie. 021121234 - > 21121234

thanks
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

If you move it to a numeric field, it will automatically do it for you.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can perform arithmetic on it. For example add zero to it. DataStage returns the shortest possible string when arithmetic results are presented.

Other approaches use the Trim() function, the Fmt() function, or the Iconv() function, not to mention reinventing the wheel by writing your own routine.

But arithmetic, or Sainath's solution (loading into an Integer column will automatically remove the leading zero), are the efficient mechanisms.
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