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 > Fixed File Export

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-02-04, 10:44
atmosphere atmosphere is offline
Registered User
 
Join Date: Aug 2004
Posts: 19
Fixed File Export

hey

Im trying to (from a command line) direct output to a file with a fixed format.
Initially what I have done is padded all of my field strings with the correct number of blank spaces. Therefore if i could output each field side by side with no spaces inbetween them in one continuous string, that would be ideal. The closest thing I have got to this is exporting with DEL format, but then i would have to remove all of the quotations and commas with some program but my superiors do not want me to do this.

I have also tried piping my results to a file but im unsure how to make each field a specific length.

I am looking, i guess, for one of two answers

1) How can I output all fields in one continuous string without any spaces inbetween?

2) If i am just using standard output (or piping) how do i make a specific field a constant specified length?

Thank you
Reply With Quote
  #2 (permalink)  
Old 09-02-04, 11:18
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
If you do a select * and pipe the data to a file, the output length of each column will be fixed, although there will be spaces between the columns. The number of spaces between the columns may depend on the column heading (name), even if column headings are surpressed. You can then import the data using "non delimited ascii" format. You can use the graphical mapper to figiure out the starting and ending column postions of each item.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 09-02-04, 13:09
atmosphere atmosphere is offline
Registered User
 
Join Date: Aug 2004
Posts: 19
>>You can then import the data using "non delimited ascii" format. You can
>>use the graphical mapper to figiure out the starting and ending column
>>postions of each item.


Could you please explain how to import using non delimited ascii format. And possibly give a little information regarding the graphical mapper. I have never used these tools before
Reply With Quote
  #4 (permalink)  
Old 09-02-04, 14:38
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Using the Control Center, right click on the table name and select "import" Then select the "non delimited ascii" radio button. Then select the "columns" tab, and you can use the graphical mapper to define the starting and ending postion of each column. You will need to specify the data file where the data resides (the result of the "select *").
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
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