Defining file dependencies to check for file changes

You can use the filewatch utility to check for file system changes on files and directories, for example, when you want to make sure that a file exists before running a job that processes that file. By defining a job that runs the filewatch utility, you can implement file dependency, that is, a relationship between a file and an operation in which specific activity on the file determines the starting of the operation.

To run the filewatch utility you can use variable substitution, which occurs when:
  • The controller submits the job associated to a JOBLIB member. For details about the scheduler job tailoring, see Managing the Workload.
  • The HCL Workload Automation Agent submits the job. For details about submitting a job, see Defining a job in the JOBLIB data set.

Syntax

filewatch -v | -u | -?

filewatch -c[ondition] condval -f[ilename]  file_path -dea[dline] deadline
     [-i[nterval] interval]
     [-dat[abase] log_extension]
     [-r[eturncode] rc]
     [-t[race] trace level]

The arguments are not positional. You can use an abbreviated format for all the arguments. Generally you can truncate the arguments to any position following the first character, except for deadline and database that require at least three characters.

-v
Returns the command version and exits.
-u
Returns command usage information and exits.
-?
Same as -u
-condition
The condition to be checked. Valid values are:
wcr | waitCreated
Waits until the file exists. If the file already exists, filewatch exits immediately. If -filename argument specifies a directory, the process waits until the directory exists and contains a new file.
wmr | waitModificationRunning
Waits until the file size or modification time changes. If -filename argument specifies a directory, the process waits until the size or earlier file modification time changes, when a file is created, modified, or deleted.
wmc | waitModificationCompleted
Checks that the file size or modification time stopped changing, meaning that filewatch waits for three search intervals without any change. If -filename argument specifies a directory, the process checks the size or the earlier file modification time change, for example if the number of directory files and the earlier file modification time does not change within three search intervals.
wmrc | waitModificationRunningCompleted
Waits until the file size or modification time changes and stops changing, meaning that, after the first change, filewatch waits for three search intervals without any further change. If -filename argument specifies a directory, the process checks the size or the earlier file modification time change, for example if the number of directory files and the earlier file modification time does not change within three search intervals.
wdl | waitDelete
Stops running when the file is deleted. If -filename argument specifies a directory, the process waits until a file is deleted from the directory.
-filename
The file path to be processed. You can embed blank or special characters, by using double quotation marks. Wildcard characters are not supported. To include more files in the monitoring process, you can store those files in a specific directory and use a file path specifying that directory. When filewatch is used on a Windows server, and the file path specifies a directory, the path name must not include a trailing forward slash "/" character.
-deadline
The deadline period, expressed in seconds. The allowed formats are:
  • An integer in the range 0 to 31536000 (the upper value corresponds to one year). To have filewatch performing an indefinite loop, specify 0.
  • hh:mm:ss, in the range 00:00:01 to 24:00:00, to select a time within the same day when filewatch started.
-interval
The file search interval, expressed in seconds. Specify an integer in the range:
  • 5–3600 when specifying wcr or wdl as condition value.
  • 30–3600 otherwise.
The default is 60.
-database
Optional extension of the log database, that is the database where filewatch stores the file status. If you specify this value, filewatch updates the TWA_home/TWS/filewatchdb.log_extension database, otherwise TWA_home/TWS/filewatchdb is updated.

For details about the log database, see Maintaining the filewatch log database.

-returncode
The exit return code, if the condition is not successfully checked by the deadline. Specify an integer in the range 0 to 256. The returncode value is ignored if you specify 0 as deadline value. The default is 4.
-trace
Trace level for internal logging and traces. Possible values are:
0
To receive error messages only.
1
Indicates the fine level, to receive the most important messages with the lowest volume.
2
Indicates the finer level, to activate entry and exit traces.
3
Indicates the finest level, to receive the most detailed tracing output.
The default value is 0.

You find the trace output in the log of the job that run filewatch.