Page 1 of 1

[File Connector] Not delimited Files

Posted: Wed Feb 06, 2019 1:27 am
by joycerecacho
Hi everybody.

I am using 'File Connector' object to read txt files from HDFS. but some of them are not delimited, fields are positionals.

Example:
JoyceRecacho34 years oldBrasil

In other words, it would be like:

Field1: Row[1,12]
Field2: Row[13,12]
Field1: Row[25,6]

=======
I noticed that using the File Format like 'Implicit', some of the rows are split correctly however the majority of rows are disaligned, being droped.

Has anybody already passed through this issue?

As a workaround I read the file as it was a delimited one, and cut the fields like:
Field1: Row[1,12]
Field2: Row[13,12]
Field1: Row[25,6]

It worked fine, but the customer prefer the fields delimited conforming its definition at the sheet 'Column'.
Is there any way?
It reminds me the 'Sequential File' that we just inform "Record Length = Fixed" and "Delimiter = None" and it works.

Thanks in advance.

Best regards,

Posted: Wed Feb 06, 2019 8:08 am
by UCDI
for fixed positions, left and right should do it. you can string these together eg
f1 = left(in, 12)
f2 = left(right(in,12),12)
etc

Posted: Wed Feb 06, 2019 9:52 am
by joycerecacho
Did you mean... in a transformer, as I did?
Cause I was thinking about solve it through File Connector only.

Posted: Wed Feb 06, 2019 9:24 pm
by ray.wurlod
Try using a Sequential File stage, specify Fixed Width when importing the metadata, and specify the column widths during that process. Or edit the table definition details, and set the column Width property for each column.

Posted: Thu Feb 07, 2019 2:10 am
by chulett
I know he'd do this since it's only three more words. Here's what is cut off:

"roperty for each column."

Posted: Thu Feb 07, 2019 2:28 am
by joycerecacho
Oh nice, Ray.

I am still having problems.

Actually I read that you can configure the properties of the 'File Connector' the way it can understand the fixed width of the fields:

* File format: implicit
* Record definition: Delimited String
* Definition source: <name>:<definition>[length]
Between each field definition I tried ' ' or nothing ''
eg:
FieldName1:Char[1]FieldName2:Char[1]
FieldName1:Char[1] FieldName2:Char[1]

I might informed something wrong cause it didnt work.

Any suggestion?

Posted: Fri Feb 08, 2019 2:46 am
by chulett
Guessing IBM would know... <crosses fingers>

Posted: Sun Feb 10, 2019 10:38 pm
by ray.wurlod
Try importing the Sequential File definition (not via the File Connector) then proceed as I earlier advised. You may need to share the result into the common metadata repository from DataStage Designer, but that's not difficult.

Posted: Wed Feb 20, 2019 2:18 am
by joycerecacho
Hi Ray,
Could you help me?

Tks in advance.

Posted: Wed Feb 20, 2019 7:49 pm
by chulett
You've got the important bits. However...

"r, but that's not difficult."

Posted: Wed Feb 27, 2019 7:55 am
by joycerecacho
It didnt work here, so I let the solution like initially: I split the positional file cutting columns inside transformer.
Unfortunately, just a workaround for now.