Command: SET
Purpose: Creates a new persistent array record on the GT.M or Caché system, or updates the value of an existing record.
Note that no pre-declaration of either the array name or its subscripting structure is required. Creation of array records is totally dynamic.
Arguments:
Argument No | Description |
1 |
The array node to be created or updated. This takes the format: arrayRef[subscr1,subscr2,..etc] You may specify no subscripts at all, in which case the top-level node is set,eg: arrayRef Setting a value at the first level of subscripting would look like: arrayRef[1] Setting a value at the second level of subscripting would look like: arrayRef[1,"aaa"] Note that subscripts can be numeric or text. Text subscripts must be wrapped in double quote (") characters. Quoting of numeric subscripts is optional. |
2 | The number of bytes that follow in the next line to be sent by the client that defines the data. |
Response
Single-line response
A successful SET returns +OK
Examples
Client: SET test1["a","b"] 5 Client: hello Server: +OK
Client: SET test1 22 Client: This is the top level! Server: +OK
To set a null value, use a length of zero followed by an empty next record (the following example has been extended to show the terminating CRLFs for clarity):
Client: SET test1["a","c"] 0\r\n Client: \r\n Server: +OK\r\n
For those familiar with the native language of GT.M and Caché systems, the above two examples are the equivalent of:
set ^test1("a","b")="hello" set ^test1="This is the top level!" set ^test1("a","c")=""