how to get rid of unreadable characters generated by fastExport

Tools
Enthusiast

how to get rid of unreadable characters generated by fastExport

I read posts in this forum about how to get rid of unreadable characters generated by fastExport and I tried all the ways you guys suggested but it doesn't work for me. Anyone knows the reason causing this? Thanks in advance!!!

Here is the outputs:

$"001050|731427|0|0|0|0|0|0|0|0|0|0|
$"001050|477550|0|0|0|0|1|0|0|0|0|0|
$"001050|441807|1|2|2|1|3|0|2|0|1|0|
$"001050|698925|0|1|1|1|1|0|1|0|1|1|
#!001050|67691|0|0|0|0|0|0|0|0|0|0|

Here is the source codes:

.logtable xxx.xxxlog;
.logon aaa/bbb,ccc
database ddd;

.begin export
sessions 20;

.export outfile xyz mode record;

sel trim(cast(cast('0' as char(1))||
cast(locationid as char(5))||cast('|' as char(1))||
trim(cast(productnumber as int))||cast('|' as char(1))||
trim(cast(day01+0.5 as int))||cast('|' as char(1))||
trim(cast(day02+0.5 as int))||cast('|' as char(1))||
trim(cast(day03+0.5 as int))||cast('|' as char(1))||
trim(cast(day04+0.5 as int))||cast('|' as char(1))||
trim(cast(day05+0.5 as int))||cast('|' as char(1))||
trim(cast(day06+0.5 as int))||cast('|' as char(1))||
trim(cast(day07+0.5 as int))||cast('|' as char(1))||
trim(cast(day08+0.5 as int))||cast('|' as char(1))||
trim(cast(day09+0.5 as int))||cast('|' as char(1))||
trim(cast(day10+0.5 as int))||cast('|' as char(1)) as char(80)))
from ddd.eee where locationid=1050 and productnumber in (441807
,698925
,67691
,731427
,477550
);

.end export;

====

The reason I use lots of trim because we don't want to have spaces generated.

Any idea about that? By the way, I really hate to use the cast, the data we are going to extract are huge, just hope the cast statements won't slow the run time of the query.

3 REPLIES
SN
Enthusiast

Re: how to get rid of unreadable characters generated by fastExport

did you try with MODE INDICATOR?
Senior Apprentice

Re: how to get rid of unreadable characters generated by fastExport

You should use FORMAT TEXT.
This will get rid of the record length, but you're going to export a fixed length character with lots of trailing blanks.
IMHO it would be easier (and require less bytes) if you use fixed length without delimiters.

Dieter

Teradata Employee

Re: how to get rid of unreadable characters generated by fastExport

If all else fails you can always strip them out using the unix tr -d command after the fact.

#Remove excess spaces in dat file
tr -d ' ' FILE_NEW.dat

You can also do the same to strip out non printable characters like carriage returns and linefeeds.