File Operations

Sterling File Gateway provides out-of-the-box support for file content processing through several File Operations.

Prerequisites

  • You must install Microsoft Visual C++ 2017 redistributable for Windows environment.
  • You must include Libnsl.so.1 library for Red Hat Enterprise Linux v7.5 and later versions.

Introduction

A new property, accept.enable.fileOperation, is introduced in the license.properties file.

The system displays the File Operations tab in the Sterling File Gateway UI, if you set the property to true. If you set to false, the system does not display the File Operations tab.
Note:
  • By default, the property is set to false.
  • In a clustered environment, you must set accept.enable.fileOperation property to true on all nodes in the cluster.
The supported File Operations and the respective configurations are summarized in the following table:
File Operations Configurations
Line Folding - Inserts a line terminator after every X number of characters. Line folding width - Only positive integers are allowed. The default value is 80 characters.
Line Truncation - Deletes characters on a line after X number of characters. Line truncate length - Only positive integers are allowed. The default value is 80 characters.
Line Strip - Deletes the entire Line if start of the Line begins with configured characters. Line strip character - A character or sequence of characters in ASCII or standard UNICODE format like U+XXXX or \uXXXX.
Line Padding - Adds character X at the end of the line out to position Y characters.

Line padding with character - A character to pad in ASCII or standard UNICODE format like U+XXXX or \xxxix.

Till length - The configured character must be padded till the specified length is reached. Only positive integers are allowed. The default value is 80 characters.

Pad empty lines - If selected, the empty lines in the input file are padded with the configured character.

Character Replacement - Replaces character X with Y. It can be single or consecutive characters. Replace Character - A character or sequence of characters in ASCII or standard UNICODE format like U+XXXX or \uXXXX.

With - Character to replace with. Can be blank, a character or sequence of characters in ASCII or standard UNICODE format like U+XXXX or \uXXXX. If you select blank character for the replacement, the system displays a warning message before saving the template.

Dos2Unix - Converts dos format file to Unix format file (CR/LF to LF). Changes the line ending character to CRLF for all the lines in a file.
Unix2Dos - Converts Unix format file to dos format file (LF to CR/LF). Changes the line ending character to LF for all the lines in a file.
Note:
  • File Operations are supported only for out-of-the-box file types and not for custom file types.
  • File Operations are performed as per the sequence of selection. You can reorder the sequence by sliding the operations up and down.
  • The operations Dos2Unix or Unix2Dos must be the last in the sequence.
  • Input with leading or trailing whitespaces must be provided entirely in Unicode format, else the input is trimmed.
  • All File Operations in the Routing Channel Template must be removed when you want to disable File Operations. If do not remove from the template after disabling File Operations, the system displays Other Parameters List section as blank in that particular Routing Channel Template.

Additional Configurations

In addition to the above configurations, the following are the encoding configurations applicable to all File Operations:
  • Source File Encoding - specify the encoding to use for reading a file for File Operations
  • Target File Encoding - specify the encoding to use for writing a file after performing File Operations
    Important:
    • Source File Encoding and Target File Encoding configuration is applicable for all File Operations. If you wish to override the Target File Encoding, you can configure it in the Sterling File Gateway Partner UI. For more information, see Creating a Sterling File Gateway partner.
    • The system executes Target File Encoding chosen for file processing during runtime in the following order:
      • If Sterling File Gateway Partner UI has the encoding configured, the system considers this encoding configuration overriding the configuration in Routing Channel Template.
      • If Sterling File Gateway Partner UI does not have the encoding configured, the system considers the configuration specified in Routing Channel Template.
      • If the Target File Encoding is not configured at Sterling File Gateway Partner or Routing Channel Template, the system uses Source File Encoding as the Target File Encoding for File Operations.
  • File Name Pattern as Regular Expression - configure a regular expression to filter the files for which File Operations must be applied.

    The Regular Expression must be configured such that the system filters only text files to apply any of the File Operations. If you perform File Operations on non-text files, it corrupts the file. The system only routes the incoming files that do not match the Regular Expression, but does not apply any of the File Operations.

Managing DTL Files

The connect.dtljob.delete property allows you to control the creation and deletion of .dtl files during file operations. By default, this property is set to false, meaning that .dtl files will be reused for SFG transactions between producer and consumer.

To enable automatic deletion of .dtl files, set the connect.dtljob.delete property to true.