remove leading zeros in decimal field in sequential file

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

PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

priyadarshikunal wrote:... however the different rtypes are not really present there. The different options are documented in "Orchestrate Operator Reference" doc.
I don't think I have that, where would I find it? Does it come with a standard 7.5.1 client install?
Phil Hibbs | Capgemini
Technical Consultant
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, you have to dig them up on the internet... I think Ray/Arnd may have posted a link to them but not sure it would still be valid.
-craig

"You can never have too many knives" -- Logan Nine Fingers
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

you may need to contact IBM to get that manual. It was available directly through Ascential's eservice network which doesn't work anymore.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
akbar2002
Premium Member
Premium Member
Posts: 6
Joined: Wed Jul 11, 2007 11:34 am

Post by akbar2002 »

SV1 : StringToDecimal(column_name) --> DataType = VarChar
SV2 : Field(SV1,'.',1) --> DataType = Integer
SV3 : Right(SV1,2) --> DataType = VarChar

Derivation : SV2:'.':SV3 --> DataType = VarChar
Regards,
Akbar.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Did you mean DecimalToString() ?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
akbar2002
Premium Member
Premium Member
Posts: 6
Joined: Wed Jul 11, 2007 11:34 am

Post by akbar2002 »

Yes, made a typo. Sorry about that
SV1 : DecimalToString(column_name) --> DataType = VarChar
SV2 : Field(SV1,'.',1) --> DataType = Integer
SV3 : Right(SV1,2) --> DataType = VarChar

Derivation : SV2:'.':SV3 --> DataType = VarChar
Regards,
Akbar.
raghu22
Premium Member
Premium Member
Posts: 15
Joined: Sun Oct 11, 2009 11:33 am

Post by raghu22 »

IF Index(DecimalToString(decimal_input,"fix_zero,suppress_zero"), '.',1)=0 THEN
DecimalToString(decimal_input,"fix_zero,suppress_zero") : '.00' ELSE DecimalToString(decimal_input,"fix_zero,suppress_zero")
naresh_kakarla
Participant
Posts: 2
Joined: Thu Nov 18, 2010 6:17 am
Location: hyderabad

Post by naresh_kakarla »

I think the Below logic is useful for you

convert(' ','0',(trim(convert('0',' ',Column_Name)))

Note: If u r using above logic then you have to change the column datatype like Char or Varchar
Thanks
Naresh
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

The derivation surpress both Leading and Trailing zeros. So, Small change to remove leading zeros only as per the post.

convert(' ','0',(TrimF(convert('0',' ',Column_Name)))
Cheers
Ravi K
DS_TM
Premium Member
Premium Member
Posts: 17
Joined: Thu May 27, 2010 12:26 pm
Location: india

Post by DS_TM »

This won't work if we have value lilke -00000.00100.
akbar2002 wrote:Yes, made a typo. Sorry about that
SV1 : DecimalToString(column_name) --> DataType = VarChar
SV2 : Field(SV1,'.',1) --> DataType = Integer
SV3 : Right(SV1,2) --> DataType = VarChar

Derivation : SV2:'.':SV3 --> DataType = VarChar
battaliou
Participant
Posts: 155
Joined: Mon Feb 24, 2003 7:28 am
Location: London
Contact:

Post by battaliou »

I know this is an old post, but our solution is to change the input datatype from a decimal to a varchar
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

True... and mentioned as the solution in the very first reply as well. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply