Determining how to append the output of an ETL to an existing file using FileAppenderA

This topic describes FileAppenderA, that is an action that appends the content of a source file to a target file, optionally skipping N lines.

For example, skipping N lines is useful when appending a CSV file to another, to delete the line containing the header. Or, this action can be used to extract data using an SQL query and write the output to a log file, where a monitoring system is listening for changes and raises a trap when certain conditions are met.

Particular attention has been given to file access rights: existence, reading and writing permissions are checked, and appropriate error messages are shown.

Properties

New properties that need to be defined are:

  • action.MODINDEX.sourcefile (mandatory)
  • action.MODINDEX.skiplines (optional)

The following property is already present as a configuration property for other purposes:

  • action.MODINDEX.targetfile (mandatory)

Example

To append the output of the CSV Loader to another file, use the following code:

action.1.execute.before=STOP
action.1.module=ETL::action::FileAppenderA
action.1.skiplines=1
action.1.sourcefile=%BASE/output/%AYEAR%AMONTH%ADAY%AHOUR%ZPROG%SRCID
action.1.targetfile=/app/cpit2/repository/bki/alarms.log |
Was this page helpful? Yes No Submitting... Thank you

Comments