Command Reference : Command Reference
  
 
exec
Execute a program.
The exec command executes a program. The program may be located in memory or stored in a program file on disk.
Syntax
exec(options) [path\]prog_name(prog_options) [%0 %1 …]
If you wish to pass one or more options to the program, you should enclose them in parentheses immediately after the filename. If the program has arguments, you should list them after the filename.
EViews first checks to see if the specified program is in memory. If the program is not located, EViews then looks for the program on disk in the EViews Add-ins directory, or in the specified path. The program file should have a “.PRG” extension, which you need not specify in the prog_name.
Options
 
integer (default=1)
Set maximum errors allowed before halting the program in interactive mode.
Note that the integer option does not apply when using exec in a program, it only applies when using exec from the command line. When using exec in a parent program to execute a child program, the child program inherits the maximum error count from the parent.
c
Run program file without opening a window for display of the program file.
verbose / quiet
Verbose mode in which messages will be sent to the status line at the bottom of the EViews window (slower execution), or quiet mode which suppresses workfile display updates (faster execution).
v / q
Same as [verbose / quiet].
ver4 / ver5
Execute program in [version 4 / version 5] compatibility mode.
this=object_name
Set the _this object for the executed program. If omitted, the executed program will inherit the _this object from the parent program, or from the current active workfile object when the exec command is issued from the command window.
Examples
exec rollreg
will run the program “Rollreg.prg” in the EViews add-in directory.
exec(this=graph01) recshade
will run the program “Recshade” in the EViews add-in directory, setting the _this object to GRAPH01.
exec(4) c:\myfiles\simul.prg(h=3) xhat
will run the program “Simul.prg” in the path “c:\myfiles\”, with program option string “h=3”, the %0 argument set to “XHAT”, and with the maximum error count set to 4.
Note that in contrast to the run command, exec will not stop executing a running program after returning from the executed program. For example if you have a program containing:
exec simul
print x
the print statement will be executed after running the “Simul.prg” program. If you replace exec with run, the program will stop after executing the commands in “Simul.prg”.
Cross-references
See “Executing a Program” and “The Active Object Keyword” for further details.
See also run and include.