Previous Topic: Ensuring a file exists before processingNext Topic: Processing a changing file name


Using date-qualified file names

Objective

An Application contains some file trigger jobs, where the names of the files to be created contain a date qualifier and a literal in the form MMDDYY_ok, where MM is the scheduled month, DD is the scheduled day, and YY is the scheduled year.

Solution

When you define the file trigger jobs, you can use built-in symbolic variables for the date and concatenate the literal at the end. For example, in the File name field you can use the following:

/batch/interfaces/file1.%APPL._SMM%APPL._SDD%(APPL._SYY)_ok

Note: You need to enclose APPL._SYY in brackets, as the brackets act as delimiters. Otherwise, the server will try to resolve a variable named APPL._SYY_ok.

Explanation

When the Application generates, it resolves the built-in variables based on the scheduled date of the Event. For example, on November 6, 2006, the above example resolves to the following file name:

/batch/interfaces/file1.110606_ok

Variation

Another approach is to define a symbolic variable, representing the string, in a JavaScript script. You can then use this variable in your job definitions. This is useful when you need to use this file qualifier for many jobs. Also, if the format of the file name changes, you need only to update the format in one place.

For example, use the following JavaScript script at Event trigger time:

APPL.datequal = APPL._SMM + APPL._SDD + APPL._SYY + '_ok';

When you define a file trigger job, you can use this variable in the File name field, for example:

/batch/interfaces/file1.%APPL.datequal