Previous Topic: Using date-qualified file namesNext Topic: Using the Application name in the script path


Processing a changing file name

Objective

When a file is created, a UNIX script needs to use the file name as input. The last 12 characters of the file name always change and are based on a date and time stamp. An example of such a filename created on 09/29/04 at 23:14:56 is “file092904231456”.

Solution

To process a changing file name

  1. Define the file trigger job (for example, CREATE).
  2. Define the UNIX script as the successor job (for example, PROCESS). Use %APPL._ftfile in the Arguments to pass field.

    The solution looks like this:

    The diagram shows how to process a file with a name that changes based on a date and time stamp.

Explanation

The file trigger job waits for a file to be created that matches the file name mask /export/home/jsmith/file*. When any such file is created, the file trigger job completes and releases the successor job to process the file.

The built-in variable, APPL._ftfile, is assigned a value of the full file name whenever file trigger activity takes place. You can pass this variable as an argument to the UNIX script run after the file trigger completes.

There is only one APPL._ftfile variable per generation of an Application. When additional file triggers take place in the same generation of the Application, the previous APPL._ftfile variable is overwritten.