To File

Introduction

Configure the settings for the To File (legacy) destination component.

The To File component outputs files to a specified local source directory. It can also upload files to FTP.

Tip:  For greater control over writing files and ftp we recommend using a To Translator component with the io file functions for reading files and the net file transfer functions for ftp, ftps and sftp.

From here you can choose basic options for working with local files, FTP upload options and and specify the format of messages contained in input files.

  • Click the Edit Channel button
  • Enter your settings and click Save Changes

File Options [top]

Settings for processing files from a local source directory.

Destination directory

  • Select the directory path for the output files
    Note: This directory must already exist

Write each message to

  • Choose to write all messages to A single file, or write messages to Separate files
  •  If you choose to write all messages to A single file, you must enter the file name:
    • File: Enter the file name in this field
    • Periodic file rollover is supported, use  format specifier(s) to indicate the rollover interval (i.e., using %d will create a new file every day)
  • If you choose to write messages to Separate files, you must enter the following information:
    • Use as file ID: choose the type of file ID from the listbox:
      Option Description
      Unique ID Create an identifier consisting of the current date and time and a five-digit index.The index is used to uniquely identify the message if more than one message is generated in the same second. The first message is given an index of 00000, the second is given 00001, and so on.For example, the second message generated on September 24, 2008 at 3:43:04 pm would have the identifier 20080924154304_00001.
      Timestamp Use a timestamp as the identifier. This timestamp is accurate to the current millisecond.
      Custom Timestamp Create a custom timestamp. This timestamp must contain the following format specifiers:

      • %Y (year)
      • %m (month)
      • %d (day)
      • %H (hour)
      • %M (minute)
      • %S (second)
      • %f (millisecond)
      Integer index Use an integer index as the unique identifier. This index is increased by one whenever a new file is created.
      Padded integer index Use an integer index as the unique identifier, and pad the index until it is a specified number of digits. This index is increased by one whenever a new file is created.
    • Next file index: Enter an integer starting value for the index (if the index is already used Iguana will stop the channel and display an error)
      Note: This field is displayed for the 4th and 5th options (Integer index and Padded integer index)
    • Number of padded digits: Select the number of padded digits to use, i.e., if you select 5 and the index is 999, the padded integer index is 00999.
      Note: This field is only displayed for the last option (Padded integer index)
    • Output file mask: Enter a file mask for creating the file names
      Note: This field is displayed for the all the options

      • For the 3rd option the mask must contain %Y (year), %m (month), %d (day), %H (hour), %M (minute), %S (second) and %f (millisecond)
      • For all other options the mask must contain %i, which represents the file ID shown above
    • Temporary file extension: Specify the suffix for a temporary working file to use while generating the output message (if the field is le allft blank the output is written directly to the output file)
      Note: This field is displayed for the all the options

      Note: This is useful for ensuring that other systems do not read a partially written file.

      For example, if an output file is named output_28.hl7 and the temporary extension is tmp, the temporary working file would be output_28.hl7.tmp. When the output message is completely generated, output_28.hl7.tmp would be renamed to output_28.hl7.

Output file encoding

  • From the list box select the encoding that is used in the output file. The Windows default encoding is Western (Windows-1252), on Linux or Mac OS X the default Western (ISO-8859-1). These two encodings are not significantly different.

FTP Options [top]

Settings for uploading files to an FTP server.

  • Check the Upload to FTP checkbox
  • Select FTP from the FTP protocol listbox
  • Fill in the remaining fields

FTP server

  • Enter the name of the FTP server to use

FTP port

  • Enter the port for the FTP server, for FTP this is usually port 21

FTP username

  • Enter the username for the FTP server

FTP password

  • Enter the password for the FTP server (if required)

FTP path

  • Enter the location of the FTP server upload directory (the path is relative to the FTP user’s home directory)

Use remote temporary file

  • Select this option to use a temporary file when uploading. When the upload is complete, this temporary file is renamed to the final file name.

    Note: This is useful for ensuring that remote systems do not read a partially uploaded file.

    Disable this option if the remote server reports a “rename failed” error and leaves a temporary file with the extension -upload, and the channel stops. This typically means that the server is employing its own temporary file mechanism that is incompatible with Iguana.

Attempt to reconnect?

  • Select a reconnection option from the droplist:
    • Yes (unlimited) to keep trying
    • Yes, with limit to make a specified number of attempts
    • No to prevent reconnecting
  • If you chose Yes, with limit enter the number of times into the second field

Reconnection interval

  •  Enter the number of milliseconds before trying to reconnect
    Note: This field only appears if you enabled reconnections above

Keep local files

  • Select this option to keep local copies of the generated files

FTP overwrite handling

  • Select what you want the channel to do when a remote file that you are attempting to write already exists:
    • be overwritten: Will overwrite remote file
    • be skipped: Will skip the remote file
    • stop the channel: Will stop the channel

FTPS Settings [top]

Settings for downloading files from an FTPS server

  • Check the Upload to FTP checkbox
  • Select FTPS (FTP over SSL) from the FTP protocol listbox
  • Fill in the remaining fields

FTP port

  • Enter the port for the FTP server, for FTPS, this is usually port 990

FTP path

  • Enter the location of the FTPS server upload directory (the path is relative to the FTPS user’s home directory)

Certificate file

Private key file

 Verify peer

  • Check Verify Peer to verify the server sending you messages

Certificate authority file

SFTP Settings [top]

Settings for downloading files from an SFTP server.

  • Check the Upload to FTP checkbox
  • Select SFTP (Secure Shell FTP) from the FTP protocol listbox
  • Fill in the remaining fields

Authentication

  • Select the authentication type for SFTP from the listbox (Username/Password or Private/Public Key)

Tip: If you have selected Private/Public Key from the Authentication list box, the FTP server’s SSH daemon will need to be configured so that it will not prompt for a password when Iguana is downloading files.

FTP port

  • Enter the port for the FTP server, for SFTP, this is usually port 22

FTP path

  • Enter the location of the SFTP server upload directory (the full/absolute path is used for SFTP)

Verify host fingerprint

  • Check this to verify the authenticity of the server that is receiving the messages

Host fingerprint

  • This field contains the host fingerprint a 32-character string created using the MD5 cryptographic hash function
  • If the field is empty click the Get Fingerprint link to obtain the host fingerprint

Private key file

Public key file

Setting the File Rollover Period [top]

When output messages are written to a single file, you can use format specifier(s) to indicate that a new file is to be created after a specified time period. For example, if you specify the file specifier %d, a new file is created every day.

If two or more format specifiers are supplied, a new file is created for whichever time period is more frequent. For example, if you type %Y%B%d.txt in the File field, file names such as 2009July17.txt are generated, and a new file is created every day.

Note: If a file already exists, a new version of the file is created. An index, enclosed in parentheses, distinguishes the old file from the new one. For example, if a file named 2009July17.txt already exists, a new file named 2009July17(1).txt is created.

Tip: Providing multiple format specifiers is recommended, as this makes it easier to keep track of when message files were generated.

If you are using format specifiers to create a custom timestamp, the following format specifiers are required:

  • %Y (year)
  • %m (month)
  • %d (day)
  • %H (hour)
  • %M (minute)
  • %S (second)
  • %f (millisecond)

The following format specifiers create a new file every hour:

Format Specifier Description Example
%H Hour in 24-hour format (00-23) 15
%I Hour in 12-hour format (01-12) 04

The following format specifiers create a new file every day:

Format Specifier Description Example
%a Weekday name, short version Thu
%A Weekday name, full version Thursday
%d Day of the month (01-31) 19
%j Day of the year (001-366) 143

The following format specifiers create a new file every week:

Format Specifier Description Example
%U Week number, with the first Sunday as the first day of week 1 (00-53) 28
%w Weekday as a decimal number with Sunday as 0 (0-6) 4
%W Week number, with the first Monday as the first day of week 1 (00-53) 29

The following format specifiers create a new file every month:

Format Specifier Description Example
%b Month name, short version Aug
%B Month name, full version August
%m Month as a decimal number (01-12) 06

The following format specifiers create a new file every year:

Format Specifier Description Example
%y Year, last two digits (00-99) 09
%Y Year, all four digits 2009

The following format specifiers are primarily for use in custom IDs that can be defined when writing each message to a separate file:

Format Specifier Description Example
%f Milliseconds (000-999) 225
%M Minute (00-59) 26
%p AM or PM AM
%S Second (00-61) 38
%% The % character %

 

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.