| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (9 out of 11)

Passing Variables and Parameters

Within G2, in almost all cases when you refer to a variable or parameter, the expression returns the value of the variable or parameter. When passing variables and parameters across a G2 to G2 connection, the value is not passed unless you explicitly state that it should be.

These are the ways in which you can pass variables and parameters:

Passing a Variable or Parameter as a Copy or Handle

You can pass a copy of a variable or parameter with all of its user-defined attributes and none of its system-defined attributes by using a declaration such as:

You can pass a variable or parameter as only a handle. For example, use a declaration such as this to pass a variable or a parameter as a handle:


Passing the Current Value of a Variable or Parameter

You can pass the current value of a variable or parameter by specifying that in the RPC grammar.

To pass a variable or parameter value:

As a basic example of passing a variable value, the two procedures below illustrate:

  1. A procedure in the local G2 that calls the remote variable-value procedure across the data interface object and displays the return results.

  2. The remote procedure declaration indicating that the value of the local variable should be passed to the remote procedure.

  3. The remote procedure that:

    1. Transfers the variable passed from the local G2 onto the workspace of the procedure.

    2. Names the variable.

    3. Performs a collect data statement to get the current value of the variable.

    4. Returns a text string that includes the value, and which is what the local procedure displays.


| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (9 out of 11)

Copyright © 1997 Gensym Corporation, Inc.