REMOTEEXEC

REMOTEEXEC

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

REMOTEEXEC

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

Syntax 1

REMOTEEXEC server expression

Parameters

serverAny character string expression that evaluates to “ZIMSERV”, “JDBCSAM” or an alias name representing a valid server name to which the application is already connected.
expressionAny value expression.

Syntax 2

REMOTEEXEC server PROCEDURE ProcedureName (arg1, arg2, ...) USING obj1 obj2 ...

Parameters

ServerAny character string expression that evaluates to “ZIMSERV”, “JDBCSAM” or an alias name representing a valid server name to which the application is already connected.
ProcedureNameThe name of the remote procedure. This must be a simple or qualified name. It is not necessary that it exist on the client side.
, . . .Expressions whose values become arguments to the remote procedure. For OUT or INOUT parameters, these must be variables, form fields, or procedure variables.
. . .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 and then executed against the specified server.

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

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

This command was originally SERVEREXEC although only 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  "

To copy a file from the server to the client:

REMOTEEXEC "zimserv" "!copyfromserver" " "
source

 

 

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.

 

 

target

 

 

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

 

 

optional_dirid

 

 

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 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

(arg1, arg2, …)

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

Examples

remoteexec "oracle" "alter rollback segment big_seg"
transaction
  remoteexec "oracle"
  "set transaction use rollback segment big_seg"v
 ... large update transaction ...
endtransaction
remoteexec "oracle" "alter rollback segment big_seg offline"

See Also

$SQLErrCode

CONNECT

SET IMPLICITTRANS

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese