IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Concatenating Numeric values by removing leading zeroes


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri Sep 18, 2009 6:16 pm
Reply with quote

Oops, you must add coalesce(...,'') to compensate a length of 0 when the number is 0

Code:
with test(a,b,c,d) as (select 123, 4560,0,8090 from sysibm.sysdummy1)

select coalesce(right(digits(a),int(log10(a))+1),'')
    !! coalesce(right(digits(b),int(log10(b))+1),'') 
    !! coalesce(right(digits(c),int(log10(c))+1),'') 
    !! coalesce(right(digits(d),int(log10(d))+1),'')
from test
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
Search our Forums:

Back to Top