Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Concatenating Numeric values by removing leading zeroes
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting spaces to zeroes A_programmers DFSORT/ICETOOL 7 Tue Oct 01, 2019 12:41 am
No new posts Convert Numeric to Packed decimal and... anand1204 DFSORT/ICETOOL 5 Thu Aug 08, 2019 3:53 am
No new posts Training on numeric fields data formats sergeyken SYNCSORT 12 Thu Aug 01, 2019 8:15 pm
This topic is locked: you cannot edit posts or make replies. Removing duplicate record based on th... Nilanjan Sikdar DFSORT/ICETOOL 4 Mon Jul 22, 2019 8:29 pm
No new posts ADD/ SUB Values oerdgie DFSORT/ICETOOL 7 Thu Jul 18, 2019 5:09 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us