Databases Reference
In-Depth Information
We want the job to read a directory of files (with timestamped filenames) and pick
out the oldest file for processing. In your
DataIn\Chapter9
directory, set up five
new files, each with the filename of pattern
file_yyyymmdd.txt
. The files are shown
as follows:
Now follow the given steps:
1.
Create a new job and name it
GlobalVariablesComponent
.
2.
From the Palette, drop the following components onto the Job Designer:
tFileList
,
tIterateToFlow
,
tSampleRow
,
tSetGlobalVar
, and
tFileCopy
.
3.
Set the
tFileList
component to read the
DataIn\Chapter9
directory
and set the
Filemask
to
"*.txt"
.
4. Ensure that the
Order by
value is set to
By file name
and the
Order
action
value is set to
ASC
. This sorts the file list output data by filename
in ascending order and in our scenario puts the oldest file as the first data
element to be the output.
5. Connect the file list component to the
tIterateToFlow
component using an
iterate connector. (The
tIterateToFlow
component transforms an iterated list
into a data flow that can be processed).
Search WWH ::
Custom Search