Import Flat File tool – Locks a file for the duration of a task run preventing it from being moved by the File Management Tool.

Symptom

When importing a file using the Import Flat File tool and attempting to move it using the File Management tool, an error message is received advising the file is in use.

An example of an error message would be: The specified file [FILE PATH] is in use

Where FILEPATH is the location of the file being moved.

Cause

At runtime a task has the potential to recall or reuse a recordset therefore the data source is not released until the runtime is complete.

If the user wishes to release the file prematurely before the runtime is complete then there are two potential methods.

Resolution

This issue has been fixed in BPA Platform 2018 — go to the Release Notes.
It is recommended you upgrade to this version and re-test the task in question.

Method 1 — Use the Call Task tool to delegate the file movement to a second task

This procedure requires two separate tasks to be developed:

  1. Import the file
  2. Move the file

You add the Call Task tool as the final step in the “Import the file” task which calls (triggers) the “Move the file” task when the lock is released on the file after import.

Method 2 — Convert the output

The lock on the file can be released by changing the output to XML in the Import Flat File tool. You then run the output from that tool through the Convert XML To Recordset tool to get back your original recordset and without the file lock.

Task

Figure 1. Example task showing how to remove the file lock.

Article originally published 03 December 2015 — Article updated 09 April 2018