Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1777
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 Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts Reg:Displaying the particular month o... bhavana yalavarthi All Other Mainframe Topics 4 Sat Jul 08, 2017 8:13 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm

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