|
put.indexed.var()
Syntax
long put.indexed.var( long processno, "variable", expression, long dim1 [, long dim2, long dim3, long dim4 ] )
The assigns a new value to a specified variable in another process. It is the same as put.var() except that it enables a value to be assigned to an individual array element.
Arguments
|
processno
|
The process to which the destination variable belongs. You can specify the process ID, or you can use the predefined variables pid or parent.
|
|
“variable”
|
The name of the external variable in the other process (this must be a lower case string). Alternately, you can specify a variable in which the name is stored.
|
|
expression
|
The value to be assigned to the variable. If this is not the same type as the destination variable, it will be converted.
|
|
dim1 to dim4
|
Use these to specify a particular array element to which the new value is to be assigned. To assign a single variable value, set dim1 to 1 and omit the other dim arguments.
|
Return values
- 0 : success
- 1 : general error
- 2 : incorrect number of dimensions
- 3 : variable not found
- 4 : array element not available
Example
extern string tst_str(25) extern long ltbl(10,5)
string ret_str(10) long ret_lng long e
ret_str = "Hello" e = put.indexed.var( pid, "tst_str", ret_str, 1 )
ret_lng = 8 e = put.indexed.var( pid, "ltbl", ret_lng, 1, 1 ) ret_lng = 10 e = put.indexed.var( pid, "ltbl", ret_lng, 1, 2 ) ret_lng = 4 e = put.indexed.var( pid, "ltbl", ret_lng, 2, 1 ) ret_lng = 2 e = put.indexed.var( pid, "ltbl", ret_lng, 2, 2 ) | table is filled as follows: | ltbl(1,1) = 8 | ltbl(1,2) = 10 | ltbl(2,1) = 4 | ltbl(2,2) = 2
Related topics
|