Fast Export

Analytics
Teradata Employee

Fast Export

I have encountered some problems with Fast Export.

Using a training script to train users on Fast Export and Fast Load, we run an export and then run the load.

When we recently ran the export, the file that was output was a flat-file format, where the first column had 11 characters and the second column 6. This basically means that each column in each row is right-justified and padded with enough spaces to bring it up to the column length.

Before, when I ran FastExport it output a tab-delimited file. I could then use this file to demonstrate FastLoad. Now, I would need to open the file up in Excel, and then save it as a tab-delimited, this left-justifies the text and puts the needed tab in.

My question is how can I specify what delimiter FastExport is using?

Here is the script:

.logtable DATABASENAME.NAME_log;

.logon BOX/USERID;

.begin export sessions 4;

.export outfile
x:\export.txt

Mode record format text;

Select prdid (char (11))
,prdcd (char (6))

From DATABASENAME.TABLENAME;

.end export;

.logoff;

As I mentioned, the workaround was to open the output file in Excel, save it as a tab-delimited file and then try the fastload again, and it worked.

I am ok on Fastload, as you can directly set the delimiter you will use, or use the DEFINE to set that up. I just can't understand why FastExport is saving as a flat-file.

Any help would be appreciated!

Thanks!

Andrew Livingston
5 REPLIES

Re: Fast Export

Andrew,

FastExport will always export a flat (columnar) file in the example you gave as it doesn't have a column delimiter option per se.

What you need to do is add your own delimiter , typically a comma or '|' which you can then import using Fastload or Multiload.
So in your example try something like:

Select
Prdid (char (11))
, ',' (char(01))
, prdcd (char (6))

You then have to import as vartext and specify the said delimiter.

Not pretty but it works.

Another alternative is to get Fastexport to generate a Multiload script which can then be run but maybe that's for another course.
Teradata Employee

Re: Fast Export

LooseCannon:

Many thanks for the reply. I thought of this a few days after the post, and will now use this syntax.

It's not pretty, but I suppose one can say that it gives you total control over your export!

Many thank again!

Andrew
Enthusiast

Re: Fast Export

If you want to do it in batch, you can:

Select
Trim(Prdid)
||','
||Trim(Prdcd) (Char(40))
From ....
;

That produces a 40 character line with the comma delimited Prdid and Prdcd and spaces at the end. (BTEQ truncates trailing spaces, Fastexport does not.)
We then use a simple sed command to remove the trailing spaces and it is then ready for fastload.
rgs
Enthusiast

Re: Fast Export

Sed is a Unix command. From the Linux Man page:

Sed is a stream editor. A stream editor is used to perform basic text
transformations on an input stream (a file or input from a pipeline).
While in some ways similar to an editor which permits scripted edits
(such as ed), sed works by making only one pass over the input(s), and
is consequently more efficient. But it is sed's ability to filter text
in a pipeline which particularly distinguishes it from other types of
editors.
Fan

Re: Fast Export

sed -i 's/ //g' filename

You may also have a look at
http://student.northpark.edu/pemente/sed/sed1line.txt
for further details on sed.

sed for windows
http://gnuwin32.sourceforge.net/packages/sed.htm
might be useful as well if you're on windows.