When you’re looking for enhanced integration, try these commands that come with the Robot Schedule Enterprise extension to Robot Schedule. You’ll bring greater flexibility and creativity for coding your .bat files or scripts by allowing communication back to the IBM i server via triggering jobs, sending messages, passing values, and updating parameter values.
There are corresponding commands for both Windows and a UNIX/Linux agent. As with any commands, help features are available. These commands are located in the Robot Schedule Enterprise subdirectory located on the server.
Familiar with reactivity in Robot Schedule? This is the mechanism for setting up dependencies between jobs, whether IBM i batch or agent jobs.
One type of dependency available with Robot Schedule Enterprise is an “agent event” and one type of agent event that can be defined is a “manual event”.
The fireevent command triggers this manual agent event prerequisite for the Robot Schedule reactive job from your program, .bat file, or script, and can even pass a parameter value back. This information is stored in the agent event history as well.
fireevent edidone "EDI processing complete."
On the Robot Schedule job that reacts to the manual event EDIDONE, the value inside the quotes will be captured using a variable @@EDIDONE in the command panel of the reactive job. Use this variable to pass into another program, for example:
CALL PGM(PAYLIB/PAY105 PARM(@@EDIDONE))
The sendmsg command allows you to send a message from the agent server back an IBM i message queue. The sendmsg command can send a message back to the system or to the Robot products on the IBM i server from the agent.
You can communicate to these Robot products: Robot ALERT, Robot CONSOLE, Robot Schedule, Robot NETWORK, or back to a message queue.
For example to send a message back to the system operator message queue use this command in your .bat file:
sendmsg -m SNDMSG -r QSYSOPR -t "This message is coming from my bat file."
To send a Robot ALERT message, change the –m parameter to ALERT. To send to Robot NETWORK, change the –m parameter to NETWORK, and so on. For a full list of options see the help for this command.
The getstatus command displays the agent connection status at the agent server and can be executed from a command line on the agent to determine if it is communicating to the IBM i host.
The getactivity command displays Robot Schedule Enterprise activity at the agent server and can also be executed from a command line on the agent to list Robot Schedule Enterprise initiated active jobs, file transfers, job monitors, file monitors, directory monitors, and manual events.
The setrcv command allows you to set the value of a Robot Schedule reserved command variable to a fixed value or the value of an environment variable.
You can either specify a specific character value or, if the same variable exists in the environment variables, it will use that value.
Do not use the @@ prefix when specifying the reserved command variable. If setting to a specific value, enclose the variable and value in quotes.
To set the @@MFGTOTAL variable to a value use this command:
Or to set the @@ACCTDAY variable to the environment variable of the same name use this command:
The getrcv command retrieves the value of a Robot Schedule reserved command variable and outputs it to Standard Output. In order to use the value of that Standard Output, redirect the Standard Output to a .bat file and then run the .bat file.
cd C:\Program Files\Help Systems\Robot Schedule Enterprise Agent
getrcv mfgacct > myenv.bat
In the example above, the first command changes the directory so it can find the getrcv command. The second command gets the value of the reserved command variable @@MFGACCT, which is set up on the IBM i server that is used by the agent.
It does NOT output the value of @@MFGACCT to myenv.bat. Rather, it outputs the actual command 'set mfgacct=tuesday' ('tuesday' is the value of the reserved command variable @@MFGACCT that was retrieved).
When the third command runs, myenv.bat runs the command that is in it, which is 'set mfgacct=xxx' and the variable is set so you can use it in the remaining commands, such as in the last command.
Find out how IBM i workload automation software can help you improve the efficiency of your job schedule. Request a free demo today.