Author |
Message
|
SANTYP |
Posted: Wed Mar 05, 2008 6:46 am Post subject: How to remove Leading Zeros |
|
|
 Centurion
Joined: 27 Mar 2007 Posts: 142
|
Hi All,
Can Any one help me how to remove leading zeros...
Except casting that to integer..
like if I get input as 001205 then my output should be 1205..
with out casting the input value as integer..
Thanks in advance.. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 05, 2008 6:56 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You mean you want to trim leading characters? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
SANTYP |
Posted: Wed Mar 05, 2008 7:26 am Post subject: |
|
|
 Centurion
Joined: 27 Mar 2007 Posts: 142
|
|
Back to top |
|
 |
akir |
Posted: Tue Apr 01, 2008 11:17 am Post subject: |
|
|
 Acolyte
Joined: 28 Jun 2007 Posts: 51
|
SANTYP wrote: |
yes, but I got it.. |
k _________________ Thanks and Regards,
Akir
Tell everyone what you want to do and someone will want to help you do it.-W. Clement Stone |
|
Back to top |
|
 |
satya2481 |
Posted: Wed Apr 02, 2008 12:41 am Post subject: |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Hi SANTYP,
Could you please let us know how you implmented it in ESQL?
Bye
satya _________________ IBM Certified Solution Developer WebSphere Message Broker V6.0
IBM Certified System Administrator WebSphere MQ V6.0 |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 02, 2008 1:58 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
satya2481 wrote: |
Hi SANTYP,
Could you please let us know how you implmented it in ESQL?
Bye
satya |
I'm quite sure this was done by trimming leading characters.
 _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
akir |
Posted: Wed Apr 02, 2008 8:57 am Post subject: |
|
|
 Acolyte
Joined: 28 Jun 2007 Posts: 51
|
satya2481 wrote: |
implemented it in ESQL? |
I think this is how it is done!!
Code: |
-- In Customer Account Number leading zeroes are removed and set in Environment.
SET Environment.var.H010.CustAccNo = TRIM(LEADING '0' FROM InDataRef.HGRP_p[iHgrpIndex].H010_p[iH010Index].H010.CustomerAccNumber);
|
_________________ Thanks and Regards,
Akir
Tell everyone what you want to do and someone will want to help you do it.-W. Clement Stone |
|
Back to top |
|
 |
Kazim_Baig |
Posted: Tue Nov 01, 2016 11:21 pm Post subject: |
|
|
Novice
Joined: 26 Apr 2016 Posts: 19 Location: Bangalore
|
[quote="akir"][quote="satya2481"] implemented it in ESQL?[/quote]
I think this is how it is done!!
[code]-- In Customer Account Number leading zeroes are removed and set in Environment.
SET Environment.var.H010.CustAccNo = TRIM(LEADING '0' FROM InDataRef.HGRP_p[iHgrpIndex].H010_p[iH010Index].H010.CustomerAccNumber);
[/code][/quote]
I have used the above code, and it successful. But when the input itself is 000.000, the output for this will be .000 whereas I want it to be 0.000
Any suggestions? |
|
Back to top |
|
 |
Kazim_Baig |
Posted: Wed Nov 02, 2016 12:39 am Post subject: |
|
|
Novice
Joined: 26 Apr 2016 Posts: 19 Location: Bangalore
|
I have made use of IF Else condition like:
IF InputRoot.*.* = 0.00 Then
SET OutputRoot.XMLNSC.Value.Amount = 0.00;
Else
SET OutputRoot.XMLNSC.Value.Amount= TRIM(LEADING '0' FROM InputRoot.*.*);
END IF; |
|
Back to top |
|
 |
timber |
Posted: Wed Nov 02, 2016 12:46 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
It would be simpler to CAST to DECIMAL ( or FLOAT) and then CAST to CHARACTER with a FORMAT clause to control the style of the output string. |
|
Back to top |
|
 |
|