File Trigger is satisfied before the ENTIRE file was created

Document ID : KB000054427
Last Modified Date : 14/02/2018
Show Technical Document Details

Description

We have a file which is created by FTP from another server. It appears the FILE_TRIGGER JOB was satisfied before the ENTIRE file was created. Is there a limit on the size of the file or a default time that, once satisfied, would cause the FILE_TRIGGER JOB to complete prematurely?

Solution

FILE_TRIGGER will be marked as complete right after the FTP process starts. The reason is that, when the FTP starts, the Windows system will create the related file descriptor which makes the Agent file monitor think the file is created. The timestamp on "Date modified" doesn't change in the FTP process as the Windows system will update it when the FTP completes. This means CREATE with NOCHANGE do not work well when the file size is uncertain or the time for the whole FTP process is uncertain.

Here is a workaround. Use two FILE_TRIGGERs, one with CREATE which will fire when the FTP starts, one with UPDATE and NOCHANGE(1) which will fire one minutes after the FTP completes. See the example below:
APPL FILETRIG
FILE_TRIGGER FILETR1
  AGENT WIN_PROD
  FILENAME 'C:\FTP\TEST.txt' CREATE
  RUN DAILY
  REL FILETR2
ENDJOB

FILE_TRIGGER FILETR2
  AGENT WIN_PROD
  FILENAME 'C:\FTP\TEST.txt' UPDATE NOCHANGE(1)
  RUN DAILY
ENDJOB