Setting the Record definition property for the FileOutput and FTEOutput nodes

Set the properties on theRecords and Elements tab of the node to write files in different formats.

The following examples are based on those described in Writing a file to your local file system and Writing a file to a remote FTP, FTPS, or SFTP server. The FTEOutput does not archive, and files are transferred using IBM® MQ File Transfer Edition, rather than FTP, FTPS, or SFTP. In all examples, it is assumed that the same messages are sent to the FileOutput node; three to the In terminal and one to the Finish File terminal:
  • Three input messages which are sent, in this order, to the In terminal of the FileOutput node:
    • Message 1:
      <Message>test1</Message>
    • Message 2:
      <Message>testtwo</Message>
    • Message 3:
      <Message>testthree</Message>
    These messages can be produced, for example, by the XMLNSC domain with a message set which recognizes XML with the following form:
    <Message>...</Message>
  • A final message which is sent to the Finish File terminal of the FileOutput node after the first three messages have been sent. It does not matter what this message contains.
The following examples describe the contents of the file or files produced; the disposition of the files created is as in the Writing a file to your local file system and Writing a file to a remote FTP, FTPS, or SFTP server topics.

Example 1. Records written are separated by a DOS or UNIX line end

This example is identical to the one described in Writing a file to your local file system or Writing a file to a remote FTP, FTPS, or SFTP server. Specify the node's properties as described in Writing a file to your local file system or Writing a file to a remote FTP, FTPS, or SFTP server.

These properties result in one file being written. The file contains three records each terminated by a local system line terminator. On a Windows system, this is a carriage return (X'0D') line feed (X'0A') pair of characters; on UNIX systems it is X'0A'.
<Message>test1</Message>
<Message>testtwo</Message>
<Message>testthree</Message>

Example 2. Records written are separated by a custom delimiter

In addition to the property settings described in Writing a file to your local file system or Writing a file to a remote FTP, FTPS, or SFTP server, set these properties on the Records and Elements tab:
Property Value
Record definition Record is Delimited Data
Delimiter Custom Delimiter
Custom delimiter 0D0A
Delimiter type Postfix
The hexadecimal X'0D0A' represents a carriage return character followed by a line feed character. On a Windows system, this results in a file identical to the one created in Example 1. On other systems, the result might differ from the result in Example 1; Example 1 uses local system line end characters, whereas Example 2 always puts the X'0D0A' sequence at the end of each line.

Example 3. Records written are padded to a fixed length

In addition to the property settings described in Writing a file to your local file system or Writing a file to a remote FTP, FTPS, or SFTP server, set these properties on the Records and Elements tab:
Property Value
Record definition Record is Fixed Length Data
Length (bytes) 30
Padding bytes (hexadecimal) 2A
The hexadecimal character X'2A' represents an asterisk character in ASCII.

The length of each incoming message is 24 bytes, 26 bytes, and 28 bytes respectively. The required fixed length of each record is 30 bytes. Each record is therefore padded by an extra 6 bytes, 4 bytes, and 2 bytes respectively, using the hexadecimal character X'2A'.

One file is written. It contains a single line:
<Message>test1</Message>******<Message>testtwo</Message>****<Message>testthree</Message>**

Example 4. Records written are not separated by delimiters or padding

In addition to the property settings described in Writing a file to your local file system or Writing a file to a remote FTP, FTPS, or SFTP server, set this property on the Records and Elements tab:
Property Value
Record definition Record is Unmodified Data

The records are concatenated with no padding or delimiters.

One file is written with the following content:
<Message>test1</Message><Message>testtwo</Message><Message>testthree</Message>
There are no trailing bytes or line terminators.

Example 5. Records are written as whole files

In addition to the property settings described in Writing a file to your local file system or Writing a file to a remote FTP, FTPS, or SFTP server, set this property on the Records and Elements tab:
Property Value
Record definition Record is Whole File
Three files are created, each containing one record:
  • File 1:
    <Message>test1</Message>
  • File 2:
    <Message>testtwo</Message>
  • File 3:
    <Message>testthree</Message>
Each of these files is created with the same name, one by one, in the mqsitransit directory. If you are following the example in Writing a file to a remote FTP, FTPS, or SFTP server, each file is transferred to the remote FTP server. However, because each file overwrites the previous one, only the third file remains when the task is complete.

After optional transfer, if a copy is retained, each file is moved to the output directory, C:\FileOutput\TestDir. In accordance with the properties on the FileOutput node as described in Writing a file to your local file system or Writing a file to a remote FTP, FTPS, or SFTP server, the second file moved displaces the first file from the output directory which is moved to the mqsiarchive subdirectory with a time stamp added to the file name. When the third file is moved to the output directory, it displaces the second file, causing it to be moved to the mqsiarchive subdirectory and renamed. The final result is files similar to these:

C:\FileOutput\TestDir\mqsiarchive\20071101_165346_312030_test_output1.xml
C:\FileOutput\TestDir\mqsiarchive\20071101_165347_312030_test_output1.xml
C:\FileOutput\TestDir\test_output1.xml
being File 1, File 2, and File 3 respectively. If FTP processing was enabled, File 3 would also be in the remote FTP server directory and called test_output1.xml.