July 30, 2023

tFileInputMSPositional – Docs for ESB 7.x

tFileInputMSPositional

Reads the data structures (schemas) of a multi-structured positional file and
sends the fields as defined in the different schemas to the next components using Row
connections.

tFileInputMSPositional Standard properties

These properties are used to configure tFileInputMSPositional running in the Standard Job framework.

The Standard
tFileInputMSPositional component belongs to the File family.

The component in this framework is available in all Talend
products
.

Basic settings

Property type

Either Built-in or Repository.

 

Built-in: No property data stored
centrally.

 

Repository: Select the repository
file where the properties are stored. The fields that follow are
completed automatically using the data retrieved.

File name/Stream

Name of the file and/or the variable to be processed

For further information about how to define and use a variable in
a Job, see
Talend Studio

User Guide.

Warning: Use absolute path (instead of relative path) for
this field to avoid possible errors.

Row separator

String (ex: ”
“on Unix) to distinguish rows.

Header Field Position

Start-end position of the schema identifier.

Records

Schema: define as many schemas as
needed.

Header value: value in the row
that identifies a schema.

Pattern: string which represents
the length of each column of the schema, separated by commas. Make
sure the values defined in this field are relevant with the defined
schema.

Reject incorrect row size: select
the check boxes of the schemas where to reject incorrect row
size.

Parent row: Select the parent row
from the drop-down list. By default, it is <Empty>.

Parent key column: Type in the
parent key column name. If the parent row is not <Empty>, this field must be filled
with a column name of the parent row schema.

Key column: Type in the key
column name.

Skip from header

Number of rows to be skipped in the beginning of file.

Skip from footer

Number of rows to be skipped at the end of the file.

Limit

Maximum number of rows to be processed. If Limit = 0, no row is
read or processed.

Die on parse error

Let the component die if an parsing error occurs.

Die on unknown header type

Length values separated by commas, interpreted as a string between
quotes. Make sure the values entered in this fields are consistent
with the schema defined.

Advanced settings

Process long rows (needed for processing rows longer than
100,000 characters wide)

Select this check box to process long rows (this is necessary to
process rows longer than 100 000 characters).

Advanced separator (for numbers)

Select this check box to modify the separators used for
numbers:

Thousands separator: define
separators for thousands.

Decimal separator: define
separators for decimals.

Trim all column

Select this check box to remove leading and trailing whitespaces
from defined columns.

Validate date

Select this check box to check the date format strictly against
the input schema.

Encoding

Select the encoding type from the list or select Custom and define it manually. This field
is compulsory for DB data handling.

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at a
Job level as well as at each component level.

Global Variables

Global Variables

NB_LINE: the number of rows read by an input component or
transferred to an output component. This is a Flow variable and it returns an
integer.

NB_LINE_REJECTED: the number of rows rejected. This is a
Flow variable and it returns an integer.

NB_LINE_UNKOWN_HEADER_TYPES: the number of rows with
unknown header type. This is a Flow variable and it returns an integer.

NB_LINE_PARSE_ERRORS: the number of rows with parse
errors. This is a Flow variable and it returns an integer.

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

Use this component to read a multi schemas positional file and
separate fields using a position separator value. You can also
create a rejection flow using a Row >
Reject
link to filter the data which does not
correspond to the type defined. For an example of how to use these
two links, see Procedure.

Reading data from a positional file

The following scenario reads data from a positional file, which contains two schemas.
The positional file is shown
below:

Dropping the components

  1. Drop one tFileInputMSPositional and two
    tLogRow from the Palette to the design workspace.
  2. Rename the two tLogRow components as
    car_owner and car_insurance.

    tFileInputMSPositional_1.png

Configuring the components

  1. Double-click the tFileInputMSPositional
    component to show its Basic settings view
    and define its properties.

    tFileInputMSPositional_2.png

  2. In the File name/Stream field, type in
    the path to the input file. Also, you can click the […] button to browse and choose the file.
  3. In the Header Field Position field, enter
    the start-end position for the schema identifier in the input file,
    0-1 in this case as the first
    character in each row is the schema identifier.
  4. Click the [+] button twice to added two
    rows in the Records table.
  5. Click the cell under the Schema column to
    show the […] button.

    Click the […] button to show the schema
    naming box.
    tFileInputMSPositional_3.png

  6. Enter the schema name and click OK.

    The schema name appears in the cell and the schema editor opens.
    tFileInputMSPositional_4.png

  7. Define the schema car_owner, which has
    four columns: schema_id, car_make, owner and age.
  8. Repeat the steps to define the schema car_insurance, which has four columns: schema_id, car_owner, age and
    car_insurance.

    tFileInputMSPositional_5.png

  9. Connect tFileInputMSPositional to the
    car_owner component with the Row > car_owner
    link, and the car_insurance component with
    the Row > car_insurance link.
  10. In the Header value column, type in the
    schema identifier value for the schema, 1
    for the schema car_owner and 2 for the schema car_insurance in this case.
  11. In the Pattern column, type in the length of each field
    in the schema, the number of characters, number, etc in each field,
    1,8,10,3 for the schema car_owner and 1,10,3,3 for the schema car_insurance in this case.
  12. In the Skip from header field, type in
    the number of beginning rows to skip, 2
    in this case as the two rows in the beginning just describes the two
    schemas, instead of the values.
  13. Choose Table (print values in cells of a
    table)
    in the Mode area of
    the components car_owner and car_insurance.

Executing the Job

  1. Press Ctrl+S to save the Job.
  2. Press F6 or click Run on the Run tab to
    execute the Job.

    tFileInputMSPositional_6.png

    The file is read row by row based on the length values defined in the
    Pattern field and output in two tables
    with different schemas.

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x