Read from a fixed length file with different data types

Four Stars

Read from a fixed length file with different data types

Is there a way to read from a file that has the data stored as hex but of different data types?

For example a row may have something like:

4 byte Integer

20 byte string

8 byte floating point number

 

I would need to define the first 4 bytes as an integer, the next 20 as a string, and next 8 as a float.


Accepted Solutions
Thirteen Stars

Re: Read from a fixed length file with different data types

@cjjohna,check the below link to know how to use tFilePositional.

 

https://help.talend.com/reader/NNO~fmVQU4rlkF9Depfdxw/NPwSLaWUrdjCxpsENf7fPw

Manohar B

All Replies
Six Stars

Re: Read from a fixed length file with different data types

Hi there,

 

it seems that you need to look at tFilePositional. You will define the size of each field and apply the type after.

 

You shouldnt have to worry about the Hex factor. If you really need translation from a weird encoding, the best would be to extract everything as a String and then use a tMap to convert the data as it should.

 

Cheers,

Thirteen Stars

Re: Read from a fixed length file with different data types

@cjjohna,check the below link to know how to use tFilePositional.

 

https://help.talend.com/reader/NNO~fmVQU4rlkF9Depfdxw/NPwSLaWUrdjCxpsENf7fPw

Manohar B