If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Export as a CSV, from DB2 8.1 OS/390

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-07-07, 09:41
felx felx is offline
Registered User
 
Join Date: May 2005
Posts: 7
Export as a CSV, from DB2 8.1 OS/390

Unforunately DB2 for OS/390 can't EXPORT data as DEL, only IFX.
I need the CSV as external table in Oracle. I assume, that oracle will be not able to read IXF.

Do you have any idea how to create a CSV from a query or table in DB2 for OS/390? What are the other posibilities for linking DB2 tables to Oracle? We don't have transparent gateways here...

Is there an Perl interface for DB2? Is there an unix-based converter for IXFs?
Reply With Quote
  #2 (permalink)  
Old 03-07-07, 10:31
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
select col2,',',col3,','col4 from table1 is one option.
Another is to export the data, load into a db2 luw database (you may use the no charge - db2 express edition), reexport and load to oracle

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 03-07-07, 10:33
felx felx is offline
Registered User
 
Join Date: May 2005
Posts: 7
Quote:
Originally Posted by sathyaram_s
select col2,',',col3,','col4 from table1 is one option.
How to write 'select col2,',',col3,','col4 from table1 ' to a csv? From CLP?
Reply With Quote
  #4 (permalink)  
Old 03-07-07, 10:37
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
CLP - yes
or
DSNTEP2/DSNTEP4

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 03-08-07, 00:56
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Quote:
Originally Posted by felx
How to write 'select col2,',',col3,','col4 from table1 ' to a csv? From CLP?
Hi,
I don't like CLP because there is not possible of using operating system commands (or is more difficult). So I use Command Window.
You can use:
db2 -r output_file.txt -tf sql_file.sql

or you can also use operating system command "redirect to file" which is letter >.

db2 -tf sql_file.sql > output_file.txt

Note: On Windows "redirect to file" returns one additional character at the end of file. I suggest you to look into output_file with some hex-text tool to see the output.

-r option appends data to output_file so you need to delete the output if you like to rerun the sql_file.

Hope this helps,
Grofaty
Reply With Quote
  #6 (permalink)  
Old 03-08-07, 04:46
felx felx is offline
Registered User
 
Join Date: May 2005
Posts: 7
Yes, it's looks nice.

As a first line in my sql file I have a connect statement. How to suppress its output to flatfile? I mean the

Quote:
Database Connection Information

Database server = DB2 OS/390 8.1.5
SQL authorization ID = user
Local database alias = DB2TRALALA
at the start of file? And how to suppress the column names and separation line in the result output part of file?
Reply With Quote
  #7 (permalink)  
Old 03-08-07, 06:06
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Try this one ...

Create a file with the following commands :

Code:
update command options using o off   ;
connect to eudw  ;
update command options using o on x off  ;
 

select * from sysibm.sysdummy1 ;
Then use grofaty's suggestions

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On