Home Flat Files How to read and generate multiple flat files by transaction
Sunday, 17 April 2011 07:58

How to read and generate multiple flat files by transaction Featured

Written by 
Rate this item
(5 votes)

The solution shows how to:

·       use shell command to generate input flat file list.

·       each flat file with name <name>.<extension> from the list above is processed and written to output file under the name <name>_O.<extension>.

·       to achieve that transaction control transformation is required. For every transaction it is generated flat file with new name.   

·       expression transformation shows how to check whether new input file is processed. If new file is processed port NewFile is set to 1 (0 in other case). This is used in transaction control transformation to generate new transaction. One of more interesting issues is using local variables in the expression transformation.

 To download solution:


How to setup solution:

  1. Unzip downloded file:FlatFiles.zip
  2. Create folder: $PMSourceFileDir\FlatFiles\  
  3. Copy files: Document1.txt, Document2.txt, pliki.bat, pliki.sh  to created folder $PMSourceFileDir\FlatFiles\
  4. With Repository Manager import  FlatFiles.XML file which contains the solution workflow. The workflow read all files *.txt from folder $PMSourceFileDir\FlatFiles\ and each is written to the same folder with changed name.
  5. To change source files list change parameter for command $PMSourceFileDir\FlatFiles\pliki.bat:

$PMSourceFileDir\FlatFiles\pliki.bat  <parameter>


On the picture below, the command:

$PMSourceFileDir\FlatFiles\pliki.bat  $PMSourceFileDir\FlatFiles\*.txt

is set for command attribute of source FlatSource (for UNIX use: $PMSourceFileDir\FlatFiles\pliki.sh  $PMSourceFileDir/FlatFiles/).  


To change the target file names change output port expression in expression transformation (see picture below).






























Read 10606 times Last modified on Tuesday, 04 February 2014 21:05