Filewatch utility – file triggering
The filewatch utility is not a well known utility, that can be very handy. I have used it especially when I needed process a unix file after it has been copied to a certain directory.
This is the documentation about the filewatch utility:
Th job below is submitted and then waiting and activated when there is a change in the input directory /yourdirectory/testfileloc
The job itself moves the files in the input directory to a processing directory, starts the next “watch” job and then the processing job for the files in the processing directory.
The setup is clearly to test the mechanism – and not necessarily a model for a production-like situation. In a production situation you might want to use TWS applications etc, but that is up to your application design of course.
I hope this helps.
//STEP01 EXEC PGM=EQQFLWAT,PARM='/-c wcr -dea 900 -i 20 // -r 123 -t 3 -fi /yourdirectory/testfileloc' //* //* Register and move files //RUNSCRPT EXEC PGM=IKJEFT01,REGION=0M //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * BPXBATSL SH - mv /yourdirectory/testfileloc* /yourdirectory/testfileloc/processing //* //* Then kick off separate job //* - Next filewatch job //* //SUBJOB EXEC PGM=IEBGENER //SYSIN DD DUMMY //SYSPRINT DD DUMMY //SYSUT1 DD DISP=SHR,DSN=YOURPDS.JCL(EQQFLWAT) //SYSUT2 DD SYSOUT=(A,INTRDR) //* //* - Processing job //* //SUBJOB EXEC PGM=IEBGENER //SYSIN DD DUMMY //SYSPRINT DD DUMMY //SYSUT1 DD DISP=SHR,DSN=YOURPDS.JCL(PROCJOB) //SYSUT2 DD SYSOUT=(A,INTRDR) //* //*