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

Displaying Float variable


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arien

New User


Joined: 02 Nov 2006
Posts: 43
Location: London

PostPosted: Thu Oct 28, 2010 11:40 pm
Reply with quote

Hi Forum,

How do I convert float (in table structure) and COMP-2 USAGE DISPLAY (in DCLGEN copybook) to a displayable format?

The issue comes when I try to string this float variable with the current definition of COMP-2 to write to a file.

Pleasea advise.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Oct 28, 2010 11:47 pm
Reply with quote

Hello,

See if this recent topic about FLOAT will help:
ibmmainframes.com/viewtopic.php?t=51869
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Oct 28, 2010 11:52 pm
Reply with quote

I believe that the SQL CHAR function will give you a 24-byte right-padded string representation of a float expression, and a 42-byte right-padded string representation of a decimal float expression.
Back to top
View user's profile Send private message
arien

New User


Joined: 02 Nov 2006
Posts: 43
Location: London

PostPosted: Fri Oct 29, 2010 3:06 am
Reply with quote

Hi,

Using the CAST function in the SQL that I write within the program resolved this. I CAST-ed the float into a CHAR(13) field and it works fine.

Sample is

Code:
Select
CAST(var_1 AS char(13))
from Table A


Where Var_1 is defined as a floating point variable.

ps. I think the number of characters that should contain these values should be 53, but I am saving space lookin at the data.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Oct 29, 2010 7:12 am
Reply with quote

Good to hear you have this working - thank you for lettng us know icon_smile.gif

d
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts IBM OnDemand Folders displaying to al... IBM Tools 6
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top