Running in Batch Mode |
You can use RATS in either Interactive Mode or Batch Mode.
In batch mode, RATS automatically reads and executes instructions from an input file and saves the resulting output in a new file. This can be very convenient when you need to run long programs, because you can leave the computer unattended while RATS runs the program.
There are three basic ways to run jobs in batch mode::
•You can drag and drop files from Windows Explorer onto the RATS application window (after turning on the "Batch mode" switch as described below). This is most useful when you have several programs you want to run. (Windows version only)
•You can type in a command at the Command Prompt
•You can create separate short-cut icons for each batch job you want to run. This is most useful when you have programs you need to run repeatedly (such as a forecasting job that needs to be run each month) (Windows version only).
Drag and Drop Method (Windows only)
To run a program as a batch job using the drag and drop method, do the following:
1.Start WinRATS by double-clicking on the WinRATS icon.
2.Put RATS into "batch mode" by selecting the File—Batch Mode operation.
3.Start Windows Explorer (or other file manager application), and adjust the size of the RATS application window and the Windows Explorer window so you can see both applications on the screen.
4.Drag a RATS program file from Windows Explorer and drop it anywhere on the WinRATS application window.
RATS will execute the instructions on the selected file, and save the output in filename.ext where filename is the name (excluding the extension) of the program file, and ext is the batch-mode extension specified in the File—Preferences... dialog box.
You can run additional programs by simply dragging and dropping them onto the WinRATS application window. You can even select, drag, and drop several files at once—RATS will run each of the selected programs in order (RATS automatically clears the memory after running each program). You can put WinRATS back into interactive mode by selecting the File-Batch Mode operation again. Note that WinRATS displays a check mark next to the menu item while in batch mode. The check mark does not appear when in interactive mode.
From the Command Prompt
To run batch jobs from a command prompt:
1.From the command line, type the path and name of the RATS application file itself:
a.For Windows, the application files will be ratsv10_std for standard (or classroom) WinRATS, ratsv10_pro or ratsv10_64 for WinRATS Professional version. This will typically be installed into a subdirectory of the \Program Files directory.
b.For the Mac, this requires "drilling into" the application bundle to get to the application itself, something like "/Applications/RATS 10.0/RATS.app/Contents/MacOS/RATS"
c.On UNIX/Linux, it will be rats
This is followed by the path and name of the program file you want to run, followed by the /run switch (-run on Mac or UNIX/Linux). For example something like:
"c:\program files(x86)\rats\ratsv10_std" c:\myprog\rats\batchjob.rpf /run
If you're running command line batch jobs on a regular basis, it helps to define a (system) environment variable to simplify this. For instance, if, under Windows, you define the environment variable RATSX as (for standard RATS) as
"c:\program files(x86)\rats\ratsv10_std" /run
then you can simply use
%RATSX% c:\myprog\rats\batchjob.rpf
2.Hit <Enter> to execute the command. RATS will execute the instructions on the selected file, and save the output in filename.ext where filename is the name (excluding the extension) of the program file, and ext is the batch-mode extension specified in the File−Preferences... dialog box.
Short-cut Method (Windows only)
To run batch jobs using short cut icons:
1.Create a short-cut icon for RATS on the Start menu or on the desktop.
2.On the "command line" for the icon, include the path and name of the RATS application file itself (see above for file names), followed by the path and name of the program file you want to run, followed by the /RUN switch. For example: "c:\program files(x86)\rats\ratsv10_std" c:\myprog\rats\batchjob.rpf /run
3.Once you have saved the icon, you can double-click on it at any time to run the batch job. As with the Drag and Drop method, RATS will execute the instructions on the selected file, and save the output in filename.ext where filename is the name (excluding the extension) of the program file, and ext is the batch-mode extension specified in the File-Preferences... dialog box.
If you run RATS from the command line, you can use the command line switches /Dvariable=value or /Dvariable under Windows or -Dvariable=value or -dvariable for the Mac or UNIX to define a variable for use in the program being run. The second form of each defines a value of 1. These create an INTEGER, REAL or STRING, depending upon the form of value.
In the program, you probably want to check for whether the value has been defined. You can do that by adding a DECLARE instruction for the desired type. If the variable was defined on the command line, this will have no effect—if it wasn't, then the variable will get a standard "empty" value, which is 0 for an INTEGER, %NA (the missing value) for a REAL and an empty string for a STRING. For instance, if you want a command line definition of NDRAWS for the number of draws, adding the following to the program before you use NDRAWS will make the default 1000.
declare integer ndraws
compute ndraws=%if(ndraws==0,ndraws,1000)
Copyright © 2025 Thomas A. Doan