Writing a file to your local file system
Use a FileOutput node to write a file to a specified directory on your local file system.
Before you begin
- 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>
<Message>...</Message>
- Message 1:
- A final message, which is sent to the Finish File terminal of
the FileOutput node after
the first three messages have been sent:
<thiscanbe>anything</thiscanbe>
Procedure
Results
- The file is processed. In accordance with the values set in the
properties of the FileOutput node,
the node generates one record per message with a local file system
line terminator after each one. The file contains the following data,
each line terminated by a carriage return (X'0D') and line feed (X'0A')
pair of characters (on a Windows system):
<Message>test1</Message> <Message>testtwo</Message> <Message>testthree</Message>
- Records are accumulated in file test_output1.xml in the C:\FileOutput\TestDir\mqsitransit directory. When the final message is sent to the Finish File terminal, the file is moved to the output directory, C:\FileOutput\TestDir directory.
- If a file of the same name exists in the output directory, the
existing file is renamed and moved to the mqsiarchive directory.
For example, the following file might be created: C:\FileOutput\TestDir\mqsiarchive\20081124_155346_312030_test_output1.xmlIf a file of this name exists in this archive directory, it is overwritten in accordance with the Replace duplicate archive files property selected on the FileOutput node.
What to do next
- Appending directly:
An example is when an application uses the content of the file continually and any changes are seen as they occur. It might be that as soon as the records are seen the application loads the records into a database or a product catalog.
- Staging before appending:
An example is when an application uses the content of the file during the day, but the application does not want any updates that occur during the day to be seen. IBM® App Connect Enterprise batches the new record up in its transit directory and then, at a given time of the day (possibly outside normal working hours) the integration node appends to the file.
If a remote file exists, you can use the append mode of the FileOutput node to append to or replace an existing file. Data is either added to the end of the remote file or, if the file does not exist, the file is created.