Fastload: fixed field multibyte

Tools
Enthusiast

Fastload: fixed field multibyte

Hi

i have fixed field file in utf8 like that

field1   field2

 .я . . . .жжж

 .фф . . .у . .

dots here represent blanks. There are two fields, second field starts from 7-th position. Total record length is 10 characters. I want to load it in table

create multiset table a(a varchar(10), b varchar(10));

What fastload job script i need to write to load this?

I didn'd get it myself with Teradata Fastload Reference. Main problem as i think, that one specifies field lenghts in bytes in define command, not in characters. And in my case i have

record1 first field 7 bytes, second field 6 bytes; record2 first field 8 bytes, second field 4 bytes. Because blanks are 1 byte and cyrillic symbols are two bytes.

Thanks in advance.

11 REPLIES
Supporter

Re: Fastload: fixed field multibyte

unicode data can become tricky.

In case you want help you should attach

1. a testfile incl. unicode chars  

2. the ddl of the target table

3. any fastload script you tried so far

Enthusiast

Re: Fastload: fixed field multibyte

I didn't get how to attach here, so

1.

FIELD1 FIELD2
я ЖЖЖ
фф у

3-record text file with CR LF as line terminator

2. job script with DDL included

logon ..;

drop table errora_1;

drop table errora_2;

drop table a;

create multiset table a(a varchar(10), b varchar(10));

record 2;

set record unformatted;

define

FIELD1 (varchar(6)),

FIELD2 (varchar(3))

file=TSTu8.txt;

show;

begin loading a errorfiles errora_1, errora_2 ;

INSERT into a

values (:FIELD1, :FIELD2);

end loading;

logoff;

3. i launch fastload -c UTF-8

and got

0012 INSERT into a

     values (:FIELD1, :FIELD2);

**** 18:07:48 The length of: FIELD1 in row: 2 was greater than defined.

              Defined: 6, Received: 48111


Enthusiast

Re: Fastload: fixed field multibyte

And some details. Blanks cannot be treated as delimiters, because data can contain inner blanks.

Supporter

Re: Fastload: fixed field multibyte

below the editor is a FILE ATTACHMENTS link which you can follow and which should be straigt forward to upload files.

sg1
Teradata Employee

Re: Fastload: fixed field multibyte

For UTF8; you need to multiply your DEFINE width by 3 times the target characters.

If you column is defined as VARCHAR(10); change your define stmt to VARCHAR(30).

Enthusiast

Re: Fastload: fixed field multibyte

As you can see

http://i45.tinypic.com/2eatidi.jpg

there are no any attachment links below my post form

Here is my test case

http://www.filehosting.org/file/details/362374/tst.rar

TST.ctl - fastload script

TSTu8.txt - sample file

TST.out - output

width by 3 times didn't help me, i've got the same error.

Supporter

Re: Fastload: fixed field multibyte

strange - as you can see attached I get it a file attachemnt link.

lets see...

Supporter

Re: Fastload: fixed field multibyte

and sorry - but on mac rar files are not known.

Can you tar, zip, gzip?

Enthusiast

Re: Fastload: fixed field multibyte