Databases Reference
In-Depth Information
The second subjob checks if a file is waiting to be processed. Here we use a tFileList
component and in the If connector to the next subjob, we use the component's
global variable Number of Files . This file list component counts the number of files
matching a given file mask. We want to check that there is, indeed, a file to process,
so the code we use on the If connector is as follows:
((Integer)globalMap.get("tFileList_2_NB_FILE"))> 0
Therefore, if the number of files matching our filename mask is greater than zero,
that is there's one or more files, then the job will proceed. If there isn't, it will exit
gracefully. It is worth putting these checking components into your integration jobs.
If you don't have them, then the job would still work if a file is present, but would
error somewhere during the job if a file is not present. In our configuration, the job
will not error irrespective of whether or not a file is present.
The next subjob looks for the earliest file sent by the ERP system. We noted earlier
that the source systems can send multiple files per day and the schedule is not
predefined. Therefore, we should anticipate that the ERP system might send two
or more files in quick succession. Moreover, because we have four data sources and
these run independently, there is no guarantee that a file from a particular source
will have been processed by the time the next file from the same source arrives. The
files need to be loaded in the earliest first order so that the integrity of the source ERP
system is maintained.
The subjob lists the files in the directory that the ERP sends files to, and this data
is iterated to the rest of the subjob through an Iterate To Flow component. The file
list component is configured so that the files are iterated in filename ascending
order (which for us, given the filename convention described earlier in the chapter,
presents the earliest file first). The Iterate To Flow component turns the iterative data
into a series of rows. From the row flow, we get the first row of data (the earliest
filename) using a tSampleRow component. This single row of data is then sent to a
set global variable component, where the earliest filename is set into a variable that
we can then use throughout the job.
 
Search WWH ::




Custom Search