Equinox Online Help - Language Reference - A to Z

Home

Execute

Applies to
SyntaxExecute TaskName [FileExpression]
Action[Statement] Runs an Equinox local or remote (server-based) task, or an external task.
Scope

Local Equinox tasks are only usable from form methods or application methods, outside subtable blocks. Remote Equinox tasks can be started from anywhere. External tasks are run from anywhere using one of the following:

  • Command
  • Shell
  • System
  • Task
Notes

This statement either runs a specified Equinox task, for example a form or report, or an external program. Equinox tasks may be run locally (in the currently executing client) or remotely (in another client on the local machine or in a client running on the server). The statement ExecuteSetRemote configures a task to run remotely. Tasks do not run remotely on single-user copies of Equinox; however applications can be configured to run single or multi-user without change if required.

The first argument, TaskName, describes the type of task to execute.

FileExpression is a string and identifies the specific task file name (if required). If you do not specify a path for the file, then Equinox will search for the file. The search process used depends on the type of file specified.

For Equinox parameter files, Equinox will start in the dictionary directory (below the PARAMS directory). If the file is another directory, then you must include the relevant path.

For non-Equinox files, Equinox searches the following directories (in the specified order): the current directory, the Windows and Windows system directories (for Windows installations only), the Equinox directory and any other directories in the system PATH variable.

The following table describes the values that TaskName (and FileExpression) can take, and whether the task can run remotely:

TaskAction
CommandRun an external program in the foreground
FileExpression specifies an executable file name and optional parameters.
ConvertAllDatabasesConvert all databases to the storage manager DLL specified in FileExpression, which should be surrounded in quotes, for example "SQLDBMS.DLL". Use " to convert back to Equinox native format.
CorrectAllMirrorsCorrects the mirror for all Databases
CorrectMirrorCorrects the mirror for a single selected Database
CorrectMirrorTableCorrects the mirror for a single selected Table
DeleteDatabaseTakes a database name (not in quotes). Optimise permission is required for the user executing the code.
EmptyDatabaseClear all records from a database.
FileExpression contains the name of the table and should not be surrounded in quotes. The database is emptied starting from this table, working down the hierarchy.
Can run remotely but you must ensure you exit the client within 30 seconds to allow the remote task to gain an exclusive lock on the definition.
ExportRun an export.
FileExpression specifies the export definition file name. The name of the merge file should first be stored in the system workarea SysFilename. SysConfirm may be set, to prevent the file dialog from appearing.
Can run remotely.
ExportSetupEdit an export.
FileExpression specifies the export definition file name.
FormUse a form for data entry.
FileExpression specifies the form definition file name.
FormSetupEdit a form.
FileExpression specifies the form file name.
FormSwapUnload the current form and run a new one.
FileExpression specifies the form definition file name.
ImportRun an import.
FileExpression specifies the import definition file name. The name of the merge file should first be stored in the system workarea SysFilename. SysConfirm may be set, to prevent the file dialog from appearing.
Can run remotely.
ImportSetupEdit an import.
FileExpression specifies the import definition file name.
MethodSuspend the current application method and run a new one.
FileExpression specifies the method's file name. Can run remotely.
MethodSetupEdit an application method.
FileExpression specifies the method's file name.
MethodSwapTerminate the current application method and run a new one.
MenuSuspend the current menu and load a new one.
FileExpression specifies the menu definition file name.
MenuSetupSetup an application menu.
FileExpression specifies the menu definition file name.
MenuSwapTerminate the current menu and load a new one.
FileExpression specifies the menu definition file name.
OptimiseDatabaseOptimise a database.
FileExpression contains the name of the database and should not be surrounded in quotes.
See OptimiseDatabase for instructions on running remotely.
OptimiseAllDatabasesOptimise all databases (Includes the System database).
Cannot be run remotely at present.
ProcessRun a batch process.
FileExpression specifies the process definition file name.
Can run remotely.
ProcessSetupEdit a batch process.
FileExpression specifies the process definition file name.
QueryRun a Query.
FileExpression specifies the query file name.
QuerySetupEdit a Query.
FileExpression specifies the query file name. Can run remotely.
QuerySetupNewSpecify the default table used in query design.
FileExpression just contains the name of the table and should not be surrounded in quotes.
ReportRun a report.
FileExpression specifies the report file name. Cannot be run remotely.
See Execute Report
ReportPreviewRun a report in preview mode.
FileExpression specifies the report file name.
ReportSetupEdit a report.
FileExpression specifies the report definition file name.
ReportSetupNewSpecify the default table used in report design.
FileExpression just contains the name of the table and should not be surrounded in quotes.
To sort report records, add a comma then the index name after FileExpression.
ShellLoad CMD.EXE (under Windows NT) or COMMAND.COM (under Windows 9x) into the foreground. FileExpression specifies an MSDOS executable file, or an MSDOS command.
n.b EQSHELL.PIF is still used in Equinox 2x, no longer required for Equinox 3).
SystemLoad CMD.EXE (under Windows NT) or COMMAND.COM (under Windows 9x) into the background and wait for the command to finish before returning control to Equinox (abortable via ctrl-break). FileExpression specifies an MSDOS executable file, or an MSDOS command.
n.b EQSHELL.PIF is still used in Equinox 2x, no longer required for Equinox 3).
TaskRun the specified program in background (only available under Windows).
FileExpression specifies the executable file name.
UserManagementModify application user details
VerifyAllDatabasesOptimise all databases that have not been closed properly. Can run remotely.
VerifyAllMirrorsChecks that data in all mirrors corresponds to the data in Equinox.
The system workarea SysError is set to a non-zero value if an error occurs, otherwise zero.
If the task was a remote one, SysReply contains the task handle of the remote task, zero if it has finished, or -1 if it is not running. SysResult contains the status of the task:
  • -4    Operational error. The remote client is improperly configured or installed.
  • -3    Unable to execute. For example, the parameter file did not exist.
  • -2    Did not start. The remote client executed and logged in, but was unable to initialise.
  • -1    Running
  • 0    Finished ok
  • 1    Finished with an error. SysError was nonzero after the task finished in the remote client.
  • 2+    Finished with a user defined result. The remote task executed a statement SysResult = value.
VerifyDatabaseOptimise a database if it has not been closed properly.
FileExpression just contains the name of the database and should not be surrounded in quotes. Can run remotely.
VerifyMirrorChecks thata data in a mirror corresponds to the data in Equinox. FileExpression contains the name of the mirrored database and should not be surrounded in quotes.
VerifyMirrorTableCompare the Equinox data against the Mirrored data and report errors

If the task was external, on Win32 environments SysReply contains the value of GetLastError if an error occurred, otherwise the handle from CreateProcess.

Note that if you use the Execute statement to run a local task in a method attached to a form, control does not return to the method. The form is reloaded from scratch after the task is completed. This means that the statement cannot execute while a record is being inserted or edited. Also note that you cannot run a local task in the At Start of Task or At End of Task methods on a form. A compilation error will occur.

The following new commands are available:

  • CorrectMirror
  • CorrectAllMirrors
  • VerifyMirrorTable
  • CorrectMirrorTable

These commands check the Equinox records in the database tables or table specified against the mirror version, and if required, the "Correct" versions correct the mirror data. If a priority of 3 (low priority) is specified in the preceding ExecuteSetMode statement and the ECC is available (client-server), the task is added to the ECC table list for processing in the background by the server. For example:

ExecuteSetMode -1,,, 3
Execute CorrectMirrorTable Orders

Otherwise the task runs in the foreground as specified by the remaining ExecuteMode parameters, as normal.

The following statements affect mirror operations but are not part of the ECC:

  • MirrorDisable
  • MirrorVerifyRecord
CategoryFlow Control
See Also Block_EndBlock, BreakPressed, Continue, EnableInput, Exit, For...Next
Example

This example executes an export called endmonth. Note that the full file path has been included.

Execute Export "c:\Equinox\MyApp\params\accounts\endmonth.exp"

It was not actually necessary to provide the full file path, as the file was stored in the dictionary directory. The statement could have been written as follows:

Execute Export "endmonth"

The next example executes a batch file (in the background).

Execute Task "c:\batch\cbackup c: a:"

The last example executes a report called invoice. The file path information is stored in a local workarea.

Execute Report ReportFiles & "invoice.rep"

The last example executes a query remotely.

ExecuteSetMode
Execute Query "NewCust"