The UNIX Scheduler has a wild card file name feature in the “File Exists” and “File Does Not Exist” commands. This wildcard allows you to specify a wildcard file name (for example, * , *.* , and so on) in these two conditional commands. With this feature, you need not know the file name beforehand. The conditions for the UNIX EC Gateway Scheduler are as follows:
FILE EXISTS
With the UNIX version of EC Gateway Scheduler, the condition FILE EXISTS can be used with a specific file name or a single asterisk, for example:
/ecedigs/pf_postoffice/mailbox/in*
OR
/ecedigs/pf_postoffice/mailbox/in*.*
The difference between “*” and “*.*” on UNIX is that “*” represents any file in a directory and “*.*” only represents those files with a file extension.
FILE EXISTS AND NOT LOCKED
The condition FILE EXISTS AND NOT LOCKED cannot be used with any wildcards. It has to be used with a specific file name.
If you have a situation where you would like to use the NOT LOCKED condition, but do not know what the name of the file will be, or the file is not being locked (if running pfs/Async or FTP in host mode in the Windows environment the incoming files will not be locked and will exist the minute the file transfer begins) then you will have to use the condition FILE EXISTS with a specific file name or a wildcard. The EC Gateway process will have to contain logic to verify that the file has been completely transferred.
To create the logic to verify that the file has been transferred, follow these steps:
Use the FILE SIZE command to grab the size of a file and assign it to a COUNT variable, such as COUNT-1.
Use the TIME DELAY command to pause the process for a period of time such as 10 seconds.
Get the size of the file again and assign it to a different COUNT variable, such as COUNT-2.
Use the IFTHENELSE statement to compare COUNT-1 and COUNT-2. If COUNT-1 does not equal COUNT-2 then the file is still in the process of being transferred. Have this process stay in a loop grabbing the file size until COUNT-1 does equal COUNT-2 at which point the file has been completely transferred and the process can continue on processing the file.