Command: GET

Purpose: Returns the value of a persistent array record on the GT.M or Caché system, if it exists.

Arguments:

Argument No Description
1 The array node whose value is to be returned. This takes the format:
   arrayRef[subscr1,subscr2,..etc]
You may specify no subscripts at all, in which case the top-level node is accessed,eg:
   arrayRef
Getting a value at the first level of subscripting would look like:
   arrayRef[1]
Getting 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.

Response

Two-line response

If the specified array node exists and has a data value:

Server Line 1: $[no of bytes in next record]
Server Line 2: Data

Examples

Client: GET test1["a","b"]
Server: $5
Server: Hello
Client: GET test1
Server: $22
Server: This is the top level!

If the specified node does not exist:

Client: GET test1["xxx"]
Server: $-1

If the specified node holds a null value (""):

Client: GET test1["yyy"]
Server: $0
Server:

For those familiar with the native language of GT.M and Caché systems, the first two examples above are the equivalent of:

write ^test1("a","b")
write ^test1