FileOutput node
Use the FileOutput node to write messages to files.
- Developer
- Application Integration Suite
- Standard
- Advanced
- Express
- Scale
- Adapter
Purpose
You can write one or more messages from message flow transactions to a file in the file system of the integration node. Each message, as it is written to a file, is converted to a sequence of bytes called a record. Records are accumulated until a process is triggered that completes the file and places it either in the specified output directory or a remote FTP or SFTP server directory. Properties on the node specify how records are accumulated into files and where the files are placed when they are finished.
The FileOutput node is contained in the File drawer of the palette and is represented in the workbench by the following icon:
Record processing
The FileOutput node writes files as a sequence of one or more records. Each record is generated from a single message received on the In terminal of the node.
- Concatenated: The record created from each message is added, unmodified, to the file.
- Padded: Each record is adjusted to be a specific length and padded with a padding byte, if necessary, before being added to the file.
- Delimited: A delimiter is used to separate or terminate the records as they are added to the file.
For each message received, whether on the In terminal or the Finish File terminal, you can modify the output directory and the name of the file to be written (or finished) by using elements of the message. On the node you can specify these elements, which, by default, identify elements in the local environment, on the Request properties tab.
File processing
- After each record, if the file is to contain a single record. (Specify this behavior by setting the Record definition property to Record is Whole File on the Records and Elements tab.)
- When the Finish File terminal receives a message.
The FileOutput node uses subdirectories of the output directory to store files during and after processing. All these subdirectories begin with the prefix mqsi, and include subdirectories called mqsitransit (the transit directory), mqsiarchive (the archive directory), and mqsifailure (the failure directory). Records are not accumulated directly into a file in the output directory but are accumulated in a file in the transit directory. Files are moved from the transit directory to the output directory when the file is complete. If a file that is to be moved to the output directory has the same name as a file that is already there, you can choose whether the file in the output directory is deleted, moved to the archive directory (mqsiarchive), or renamed before being moved to the archive directory.
If a failure occurs during the final transfer of the file to the output directory, you can choose whether the file is deleted, moved to the failure directory (mqsifailure), renamed before being moved to the failure directory, or no action is taken. The chosen action is not effective if the file is being written directly to the output file on your local system and the FTP property is cleared.
You can specify that the FileOutput node transfers files to a remote FTP or SFTP server as part of file processing. If the file is successfully transferred, it can be deleted from the local file system, or, optionally, retained for the rest of the file processing to occur as usual. The server is identified by the Remote server and port property on the node. Alternatively, you can override the node property by setting a value in the local environment. You can also use the local environment to specify commands to run before or after an FTP or SFTP transfer finishes. For more information, see Local environment overrides for the remote server on the FileOutput node.
During the file transfer operation, the FileOutput creates the destination file. However, the destination file is readable before the file transfer is complete. Therefore, ensure that remote applications do not read the file until the file transfer is complete.
When multiple records are written, no file processing occurs until a message is received on the Finish File terminal of the node. Any message received on the Finish File terminal causes the file to be moved from the transit directory to either the specified output directory or to a remote FTP or SFTP directory.
It is not an error if file processing is initiated when there is no file in the transit directory.
If you set the Record definition property to Record is Whole File on the Records and Elements tab, messages received on the Finish File processing are ignored because the file has already been processed.
On Linux®, UNIX, and z/OS® systems, the permissions that new files are created with are determined by the umask value. The minimum permission required by IBM® Integration Bus for all files, including internal configuration files, is for user and group to have read/write access (660). Consequently, the umask value is set to 0006 by default.
- MQSI_SET_DFE_UMASK=nnnn
- Using this environment variable, you can override the umask for new files that are created by integration server processes. nnnn is the octal representation of the desired file creation mask.
- MQSI_UMASK_COPY=n
- If this environment variable is set to any value and MQSI_SET_DFE_UMASK is not set, the umask value is copied from the umask setting of the shell environment, which is often the system default value.
Care is required when overriding the umask value to ensure that directories and files created by IBM Integration Bus have a minimum permission of 660 and 770 respectively. A good understanding of umask is needed before using the overrides. If the permissions of newly created directories and files is overly restricted, IBM Integration Bus might not be able to restart successfully.
Message propagation
For every message received on the In terminal and successfully processed by the node, a copy is propagated to the Out terminal for further processing if the terminal is attached.
For every message received on the Finish File terminal and successfully processed by the node, a copy is propagated to the End of Data terminal for further processing if the terminal is attached.
Element Name | Element Data Type | Description |
---|---|---|
Directory | CHARACTER | Absolute path of the output directory in the form used by the file system of the integration node. For example, on Windows systems, the directory path starts with the drive letter prefix (such as C:). |
Name | CHARACTER | Name of the output file. |
Action | CHARACTER | Possible values are:
|
Timestamp | CHARACTER | The date and time, in character string form, when the node started to process this file. This value prefixes the names of files that are archived if you set the Action if file exists property to Time Stamp, Archive, Replace Existing File and Append to Existing File on the Basic tab. |
Multiple instances
Several message flows might write to the same file, which can happen where there are additional instances of the flow, or where multiple flows contain FileOutput nodes. The FileOutput node permits only a single instance, within an integration server and between integration servers, to write to a file at the same time. While a record is being written, all other instances in the integration server must wait. The order in which instances gain access is not defined.
When
the file is complete, the first instance to gain access processes
it, and other instances do not find the file. The Action element of
the LocalEnvironment.WrittenDestination.File message tree is set to Finish
for
all instances that fail to discover the file in the transit directory.
Using this node in a message flow
The FileOutput node can be used in any message flow that sends messages to files. See Working with files.
Username: FtpTargetHostUsername@ProxyUserName@TargetFtpHostname
Password: TargetFtpUserPassword@ProxyUserPassword
Other proxies might require different encodings, or might
require external configuration, or you might not be able to use them
with the File nodes.Configuring the FileOutput node
When you have put an instance of the FileOutput node into a message flow, you must configure it (for more information, see Configuring a message flow node). The properties of the node are displayed in the Properties view. All mandatory properties for which you must enter a value (those properties that do not have a default value defined) are marked with an asterisk in that view.
Terminals and properties
The FileOutput node terminals are described in the following table.
Terminal | Description |
---|---|
In | The input terminal that accepts a message for processing by the node. |
Finish File | The input terminal that accepts a message that triggers the final processing of a file. |
Out | The message received on the In terminal is propagated to this terminal if the record is written successfully. The message is unchanged except for status information in the Local Environment. |
End of Data | The message received on the Finish File terminal is propagated to this terminal if the file is processed successfully. |
Failure | The output terminal to which the message is routed if a failure is detected when a message is propagated. |
The following tables describe the node properties that you can set on a specified tab. The column headed M indicates whether the property is mandatory (marked with an asterisk if you must enter a value when no default is defined); the column headed C indicates whether the property is configurable (you can change the value when you add the message flow to the BAR file to deploy it).
Property | M | C | Default | Description |
---|---|---|---|---|
Node name | No | No | FileOutput | The name of the node. |
Short Description | No | No | A brief description of the node. | |
Long Description | No | No | Text that describes the purpose of the node in the message flow. |
Property | M | C | Default | Description | mqsiapplybaroverride command property |
---|---|---|---|---|---|
Action on final file processing failure | No | No | No Action | The action that the node takes with the output
file if the final processing of a file fails. Valid options are:
|
|
Directory | No | Yes | None | Specify the output directory in which the FileOutput node places its
files. Specify the directory as an absolute or relative directory
path. If the directory path is relative, it is based on the directory
specified in the environment variable MQSI_FILENODES_ROOT_DIRECTORY.
For example:
You can override the output directory path to be used by setting values in the current message. For more information, see the Request tab properties. |
outputDirectory |
File name or pattern | No | Yes | None | Specify a file name pattern. This property defines
the name of the file that is created by the FileOutput node. The value
is either a specific file name or a character sequence (pattern) that
matches a file name. Only patterns with a single wildcard character
(the asterisk, *) are allowed in this property field. The file name
to be used is determined in the following way:
File names are passed to the file system to which the integration node has access and must adhere to the conventions of these file systems. For example, file names on Windows systems are not case-sensitive; while on UNIX systems, they are. |
outputFilename |
Mode for writing to file | Yes | No | Stage in transit directory | Specify if the file must be staged or written
to directly. Select one of the following options:
|
|
Action if file exists | Yes | No | Replace Existing File | Specify how the file is to be processed when
it is complete. Select one of the following options:
|
|
Replace duplicate archive files | Yes | No | Cleared | Select the Replace duplicate archive files check
box to specify that, in cases where Archive
and Replace Existing File or Time
Stamp, Archive and Replace Existing File is specified in Action if file exists, files moved
to the archive directory replace files that exist there already with
the same name. By default, this check box is cleared. If this check box is not selected, and there is already a file in the archive directory with the same name as a file that is to be moved there, an exception is produced, and the new file remains in the transit directory. |
The FileOutput node Request properties are described in the following table.
Property | M | C | Default | Description | mqsiapplybaroverride command property |
---|---|---|---|---|---|
Data location | Yes | No | $Body | Specify the input data location, which is the
location in the input message tree that contains the record to be
written to the output file. The default value is $Body, meaning the entire message
body ($InputRoot.Body). When
you specify this property, and the data in the message tree that it
identifies is owned by a model-driven parser, such as the MRM parser
or XMLNSC parser, consider the following factors.
|
|
Request directory property location | Yes | Yes | $LocalEnvironment/Destination/File/Directory | Specify the location of the value to override the Directory property on the Basic tab. If you do not specify a location, the default value is $LocalEnvironment/Destination/File/Directory. If you specify a location but the element is empty or missing, the Directory property is used. The element has a data type of CHARACTER and is an absolute or relative directory path. Use the path separator character ('/' or '\') according to the file system on which the integration node runs. Trailing path separator characters are ignored. Relative directory paths are based on the value of the MQSI_FILENODES_ROOT_DIRECTORY environment variable. | requestDirectoryLocation |
Request file name property location | Yes | Yes | $LocalEnvironment/Destination/File/Name | Specify the location of the value to override the File name or pattern property on the Basic tab. The element has a data type of CHARACTER and is an explicit file name. No wildcard substitution occurs for this value. If the property is not in the local environment when the message arrives in the In or Finish File terminal of the node, then the default is to use the File name or pattern property on the Basic tab. | requestNameLocation |
The FileOutput node Records and Elements properties are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Record definition | Yes | No | Record is Whole File | Specify how the records are placed
in the output file. Select one of the following options:
|
Length | Yes | No | 80 | Specify the length (in bytes) of records when Record is Fixed Length Data is specified in Record definition. Records that are longer than this value cause an exception to be produced. This value must be in the range 1 byte through 104857600 bytes (100 MB). The default value is 80 bytes. |
Padding byte | Yes | No | X'20' | When Record is Fixed Length Data is specified in Record definition, use the Padding byte property to specify the byte to be used when padding records to the specified length if they are shorter than this length. Specify this value as two hexadecimal digits. The default value is X'20'. |
Delimiter | Yes | No | Broker System Line End | Specify the delimiter to be used
if you specify Record is Delimited
Data in Record definition.
Select one of the following options:
|
Custom delimiter | No | No | None | Specify the delimiter sequence of bytes to be used to delimit records when Custom Delimiter is specified in the Delimiter property. Specify this value as an even-numbered string of hexadecimal digits. The default value is X'0A' and the maximum length of the string is 16 bytes. |
Delimiter type | Yes | No | Postfix | If you set the Record definition property to Record is Delimited Data, use Delimiter type to specify how the
delimiter is to separate records. Select one of the following options:
|
The FileOutput node Validation properties are described in the following table.
Property | M | C | Default | Description | mqsiapplybaroverride command property |
---|---|---|---|---|---|
Validate | No | Yes | Inherit | Specify whether validation takes place. Valid
values are:
|
validateMaster |
Failure action | No | No | Exception | Specifies what happens if validation fails.
You can set this property only if you set Validate to Content or Content and Value. Valid values
are:
|
The FileOutput node FTP properties are described in the following table.
Property | M | C | Default | Description | mqsiapplybaroverride command property |
---|---|---|---|---|---|
Remote transfer | No | Yes | Cleared | To transfer files to an FTP, FTPS, or SFTP server, select Remote Transfer, then set the other properties in this table. | fileFtp |
Transfer protocol | No | Yes | FTP | This property specifies the protocol to be used for remote transfer. Valid values are:
|
remoteTransferType |
Remote server and port | No | Yes | None | This property can have either of the following values:
Specify the IP address and port number of the FTP, FTPS, or SFTP server to be used, by using the following syntax:
If you are using FTP or FTPS and you do not specify a port number, 21 is assumed. If you are using SFTP and you do not specify a port number, a port number of 22 is assumed. However, if an FtpServer configurable service is defined, you can enter the name of the configurable service in this field. If a configurable service name is specified, any or all of the other remote transfer properties on the FTP tab can be overridden by the configurable service. For information about how an FtpServer configurable service definition and the properties on this tab interact, see FtpServer configurable service.
You can override this property by setting the location of the server in the local environment. For more details, see Local environment overrides for the remote server on the FileOutput node. |
fileFtpServer |
Security identity | No | Yes | None | Specify the name of a security identity that has been defined by using the mqsisetdbparms command. The user identifier and password that are to be used to log on to the FTP, FTPS, or SFTP server are obtained from this definition. The name of the definition must have the prefix ftp:: . The value of this property is overridden by the value in the FtpServer configurable service property securityIdentity, if it is set. |
fileFtpUser |
Server directory | No | Yes | "." | Specify the directory on the FTP, FTPS, or SFTP server to which to transfer files. The default value is . (a period), which indicates the default directory after logon. If you specify a relative path, the directory is based on the default directory after FTP, FTPS, or SFTP logon. Ensure that the syntax of the path conforms to the file system standards in the FTP, FTPS, or SFTP server. The value of this property is overridden by the value in the remoteDirectory property of the FtpServer configurable service, if it is set. If the directory specified in this field does not exist on the remote server, the node attempts to create it. |
fileFtpDirectory |
Transfer mode | No | Yes | Binary | Specify how files are transferred. If the file contents are not transformed, select Binary. If the file is transmitted as ASCII, select ASCII. The value of this property is overridden by the value in the FtpServer configurable service property transferMode, if it is set. This property is valid only when FTP is selected as the protocol for remote transfer. If you have specified FTPS or SFTP as the protocol, the Transfer mode property is ignored and Binary encoding is used. |
|
Action if remote file exists | No | No | Replace File | Specify whether to create the file or append to an existing file. Select one of the following options:
|
|
Retain local file after transfer | No | No | Cleared | To retain a local copy of the file after the file transfer process has completed, select the Retain local file after transfer check box. If this check box is selected, the local copies are processed after the transfer is complete, as are other output files, as specified on the Basic tab. If the check box is cleared, successfully transferred files are not retained locally. |
Property | M | C | Default | Description |
---|---|---|---|---|
Events | No | No | None | Events that you have defined for the node are
displayed on this tab. By default, no monitoring events are defined
on any node in a message flow. Use Add, Edit,
and Delete to create, change or delete monitoring
events for the node; see Configuring monitoring event sources by using monitoring properties for details. You can enable and disable events that are shown here by selecting or clearing the Enabled check box. |