MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Display decimal

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Celeste Locklin
Beginner


Joined: 04 May 2006
Posts: 26
Topics: 10
Location: USA

PostPosted: Thu Jun 30, 2011 7:07 pm    Post subject: Display decimal Reply with quote

my table field is defined as PMT_AMT DECIMAL(11,2)
when i select it, i want it to appear in my output formatted as 00000000000.00

i have tried cast(PMT_AMT) & get a hex display
digits(PMT_AMT) & get 0000000000000
decimal . . . & get a hex display

how can i do this?

thanks in advance
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Thu Jun 30, 2011 7:53 pm    Post subject: Reply with quote

Celeste Locklin,

Did you try CHAR(PMT_AMT DECIMAL) ?

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Celeste Locklin
Beginner


Joined: 04 May 2006
Posts: 26
Topics: 10
Location: USA

PostPosted: Fri Jul 01, 2011 11:42 am    Post subject: Reply with quote

brilliant ! but it turns out to be
CHAR(PMT_AMT) DECIMAL

000000412.80

now how do i suppress those leading zeros ? Wink
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Fri Jul 01, 2011 12:22 pm    Post subject: Reply with quote

Celeste Locklin wrote:
now how do i suppress those leading zeros ? Wink


try

Code:

SUBSTR(CHAR(PMT_AMT),1,1)  ||         
STRIP(SUBSTR(CHAR(PMT_AMT),2,12),L,'0')


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Celeste Locklin
Beginner


Joined: 04 May 2006
Posts: 26
Topics: 10
Location: USA

PostPosted: Fri Jul 01, 2011 1:19 pm    Post subject: Reply with quote

amazing. Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group