Executes a command against a target server or executes a remote procedure on a Zim Server.

Syntax #1

REMOTEEXEC [ "ZIMSERV" | "JDBCSAM" | alias name ] expression



Any value expression. Expected to evaluate to a valid server name to which the application is already connected.


Any value expression.

Syntax #2

REMOTEEXEC [ "ZIMSERV" | "JDBCSAM" | alias name ] PROCEDURE <ProcedureName> (<arg1>, <arg2>, ...) USING <obj1> <obj2> ...



An expression that evaluates to a valid servername which Zim is connected to at runtime.


The name of the remote procedure. This must be a simple or qualified name. It is not necessary that it exist on the client side.

<arg1>, <arg2> . . .

Expressions whose values become arguments to the remote procedure. For OUT or INOUT parameters, these must be variables, formfields, or procedure variables.

<obj1> <obj2> . . .

Objects in the USING clause can be set names, global variables, procedure variables, form, or form entities whose values are sent to Zim Server before executing the remote procedure and are returned to Zim after the procedure has finished.

Comments - Syntax #1

Expression is evaluated, then is executed against the specified server.

If expression evaluates to a SELECT command, data is retrieved (if records meet the selection criteria), but the software cannot access the records.

If the command contained in expression fails, the server's error message is available in the system variable $SQLErrMsg.

This command was originally ServerExec. ServerExec continues to be supported for backward compatibility.

Special REMOTEEXEC Cases

The following cases of REMOTEEXEC apply only when Zim is connected to Zim Server.

To copy a file from the client to the server:

REMOTEEXEC "zimserv" "!copytoserver" "<source> <target> <optional_dirid> </b>"

To copy a file from the server to the client:

REMOTEEXEC "zimserv" "!copyfromserver" "<source> <target> <optional_dirid> </b>"


A file name on the server relative to the server's database directory. The source name can begin with one of the Zim special prefix characters and it is converted (on the server) to the actual file name.


A file name on the client (relative to the client).


An optional numeric parameter that specifies a directory id. If not specified, it defaults to zero.

/b (or /B)

Optional parameter to indicate whether the file to transmitted must be in binary or text format.  

Note: To erase a file on the server, you could copy a zero-length file over the server side file, or send "SET OUTPUT . . ."  using REMOTEEXEC.
The limit on record size is about 4000 bytes.

Note: You must insert spaces around the \ in the command.

Note: Currently, these commands do not copy files inside directories nor the directories themselves.

Note: By default, all files transferred follow the text format, meaning that line terminators are correctly converted from Windows to Unix and vice-versa. By using the "/b" or "/B" parameter, the files are transferred "as is", in binary mode. This is useful for images, etc.

Comments - Syntax #2

A remote procedure is a normal Zim procedure that is executed on Zim Server, but is invoked from a Zim client. Remote procedures are very similar to procedures that are executed locally, but they are invoked by executing a REMOTEEXEC command instead.

Field names passed as arguments to the remote procedure are not evaluated from the Zim client's current set. They are assumed to be fields on the server whose values are inherited from the current set on the server. Client side field values must be passed in as variables.

The USING clause specifies those sets that are accessible to the Zim client after the remote procedure creates them on the server. They must be known in Zim before the remote procedure is called. They can be temporary or permanent set names. For temporary set names, a command such as 'parse "find customers issue orders ->coset"' should be executed to define the set in Zim.

Global variables, forms, and form entities must be known on both client and server. Their values (or the values of their form fields or variables for forms and form entities) are sent to the server prior to the remote procedure call and then returned to the client when the procedure call is complete.

Zim evaluates the <ServerName> expression, checks that it is valid and connected to that Server, and then sends the set information, variable values, and procedure call syntax to the server. The actual procedure call that is executed on Zim Server is

<ProcedureName> (arg1, arg2, ...)

After the procedure finishes, updated set information and variable values are returned to the Zim client.


remoteexec "oracle" "alter rollback segment big_seg"
 remoteexec "oracle" \
  "set transaction use rollback segment big_seg"
 ... large update transaction ...

remoteexec "oracle" "alter rollback segment big_seg offline"


Related Topics