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: 6966
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: 6250
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: 6250
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: 6966
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Load new table with Old unload - DB2 DB2 6
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top