Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Displaying Float variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Displaying Float variable
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

Site Director


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

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

Hello,

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

Global Moderator


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

PostPosted: Thu Oct 28, 2010 11:52 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Oct 29, 2010 7:12 am    Post subject: Reply to: Displaying Float variable
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us