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
 

 

How to select FLOAT type column from a table in to flat file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Mon Oct 25, 2010 8:33 pm    Post subject: How to select FLOAT type column from a table in to flat file
Reply with quote

Dear Experts,

I have column with a datatype "FLOAT" in a DB2 table.

I like to unload the specified columns along with this FLOAT datatype column into a flat file (all other columns are alpha-numeric).

Please suggest me ,
how to write the query ?
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 25, 2010 8:44 pm    Post subject:
Reply with quote

what is your problem?

do you want to 'convert' cast the float column to something else,
or do you want to have a receiving field defined as float?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Oct 26, 2010 2:53 pm    Post subject:
Reply with quote

Once you answer the questions Dick has, M K K, this link might interest you: Equivalent SQL and COBOL data types.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Oct 26, 2010 3:31 pm    Post subject:
Reply with quote

Dear dbzTHEdinosauer,

In the table column is defined as float.
If I write the Query like

SELECT col1, col2
FROM table-name

Col2 is of datatype FLOAT, The values unloaded from a table to flat file are not readable format, How to achieve this ??
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Oct 26, 2010 3:35 pm    Post subject:
Reply with quote

That means:
Quote:
you want to 'convert' cast the float column to something else
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Oct 26, 2010 4:02 pm    Post subject:
Reply with quote

Quote:
The values unloaded from a table to flat file are not readable format


that is not true. you don't know how to read it
and it seems that you are not going to try.

if the required results are to be just a display type of report,
do as Anuj suggested and cast to another numeric datatype - that you can read

if the data is to be used as input to a program and the integrity of the value is of concern,
suggest you leave it as float,
and define it as such in the program processing the file.

you should also take the novel approach of reading the manual
concerning the loss of precision when casting float datatype columns.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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