Pad with Zeros

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
Marcus426
Participant
Posts: 33
Joined: Wed Sep 09, 2009 1:37 am

Pad with Zeros

Post by Marcus426 »

HI all,

I am using a stage variable to generate a sequence of numbers like 1,2 ,3 but in the output as 00000001, 00000002 .......... Can anyone help out in how to do this
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You will need to convert the number to a string. A simple way would be to declare a VarChar(8) field and the derivatio of

Code: Select all

Right('00000000':In.StageVar,8)
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Maybe the o/p is looking to suppress rather than expand the zeros.

In that case, search for "DecimalToString" and "suppress zeros"

Note - hints given to search and not direct use.
vive1005
Participant
Posts: 2
Joined: Wed Aug 27, 2008 12:44 am
Location: Mumbai

Post by vive1005 »

What is the datatype you have declared for that stage variable?
Vivek,
DataStage Developer
Post Reply