Sequential File Stage Example

The Sequential File stage is a file stage that allows you to read data from or write data one or more flat files. The stage can have a single input link or a single output link, and a single rejects link.

Example:

In below example, we are going to read Employee data from a sequential file which includes loading of table definition of ‘Employee’ table to the sequential file stage and viewing data from the stage. Follow below steps: Select the Sequential File stage from Palette under File option. Drag and drop the sequential file stage on the Designer work canvas and design the job as shown below:
Seq1 - Sequential File Stage Example

Open the Properties tab of Sequential file. Select Sequential File stageàRight Clickàselect Properties. And load the Table Definition.

seq2 - Sequential File Stage Example

Under Properties Tab, provide the path and file name for the file needs to be read as shown below.

Under Optionsà set ‘First Line is Column Names’ to true if first line of the file is having column names without fail, else can expect an error thrown by Datastage while reading the file.

seq3 - Sequential File Stage Example

Under Format Tab, select the Delimiter if needed.

seq4 - Sequential File Stage Example

Under Columns Tab, Select the Table definition by Click on Load button situated at the right corner as shown below. Select the Table definition from the Repository.

seq5 - Sequential File Stage Example

Select the Columns that need to be added as shown below.

seq6 - Sequential File Stage Example

The columns selected will appear as below:

seq7 - Sequential File Stage Example

We can validate the table definition and view the data from the Sequential file stage.

Click on ‘View Data’ button located at right upper corneràSelect the no. of records needs to be readà Click OK.

seq8 - Sequential File Stage Example

Data will appear as shown below.

seq9 - Sequential File Stage Example