Can File Events Automatically Populate Reserved Command Variables?

August 30, 2016


Robot Schedule now has two file event monitoring options: one is included with the base Robot Schedule software and the other requires the Robot Schedule Enterprise plug-in. Both options give you the ability to monitor for and trigger processes (jobs) based on a file event. This allows true, event-driven processing, which can execute jobs immediately (or as an additional prerequisite when other conditions are met) rather than being scheduled to run on a day and time basis.

File Events with Robot Schedule

File monitoring in Robot Schedule was delivered in the new version (Robot Schedule 12). It allows monitoring for native file events in the library or directory (IFS) structure and can monitor to the file member level. See this article for additional information.

File Events with Robot Schedule Enterprise

A powerful feature of file monitoring is the ability to capture the file name and path information, which in turn can be used in a file transfer, copy or delete operation, or combination of commands.

For instance, you may be monitoring a Windows directory for an FTP from a regional location’s point-of-sale device to be sent to headquarters. Here’s what you could do to monitor for the file, transfer it from Windows to IBM i, and trigger your nightly processing and notification:

1. Monitor for the file

Set up your file monitor agent event for your agent server. In this example, we are monitoring server HS2128_CHUCK_NOTETR from 5 p.m. until 11 p.m. every 60 seconds for the pointofsale* file in the enterprise directory. We also want to make sure the file has stabilized and not changed in 120 seconds (see figure 1).

Notice the wildcard, which eliminates concerns if additional data is appended to the file name when it is detected.

Define your agent event in Robot Schedule

Figure 1: Define your agent event in Robot Schedule.


2. Add the prerequisite to your Robot job

After you define the agent event to Robot, you then add it to the job that needs to react to the file arriving. This is added to the Reactivity panel on your Robot job (see figure 2).

Add agent event reactivity to your Robot job

Figure 2: Add agent event reactivity to your Robot job.


3. Use the reserved command variable in your command line

When Robot detects the file, it will automatically populate a reserved command variable by the same name as the agent file event. Do not predefine the reserved command variable; Robot does this automatically. In this case, @@CLPOSFIL is the automatically populated variable name that you can use on the command line of your job or in your file transfer.

Use the variable to define the file for transfer, copy or delete, or feed other commands that can exploit the file name and path (see figure 3). 

Reserved command variable defining the path and file to transfer in a Robot agent FTP job

Figure 3: Reserved command variable defining the path and file to transfer in a Robot agent FTP job.


Notice we are also appending @@DATE and @@TIME to the file as it is placed into the IFS directory (see figure 4).

IFS directory with date and time appended

Figure 4: See the point-of-sale file for August 26 and August 29 in the IFS directory with date and time appended.


Current customers can take advantage of the new file event monitoring feature by upgrading to Robot Schedule 12 from their user account. You can also experiment with reserved command variables in Robot agent FTP jobs by requesting a free trial of Robot Schedule Enterprise.

Get Started

Find out how IBM i workload automation software can help you improve the efficiency of your job schedule. Request a free demo today.

Related Products

Related Solutions

Stay up to date on what matters.