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

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


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 6965
Location: porcelain throne

PostPosted: Mon Oct 25, 2010 8:44 pm
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

Superior Member


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

PostPosted: Tue Oct 26, 2010 2:53 pm
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
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

Superior Member


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

PostPosted: Tue Oct 26, 2010 3:35 pm
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: 6965
Location: porcelain throne

PostPosted: Tue Oct 26, 2010 4:02 pm
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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts IGYPG3178-I when compiling a pgm read... COBOL Programming 6
No new posts count contained values of several col... DB2 5
No new posts FileAid move data from two files to o... Compuware & Other Tools 5
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
No new posts To Sort detail records in a file with... SYNCSORT 5
Search our Forums:


Back to Top