SAVELIST as object variables
You can access a SAVELIST
as an OBJECT
variable, provided that an object variable with the same name does not exist.
This would work
similarly to a file object, where the SAVELIST
object variable, for
example !@RESLIST
, returns the number of rows and the object variable
followed by hyphen (-), and a number returns the row number (for example,
@V(@RESLIST-1)
returns row 1).
In addition to normal
FILE
object conventions, you can access the
values of single keywords within a record as
follows:@<savelist-name>-<record-num>-<keyword-name>
For example, to list the resource names from a
SAVELIST
use the
following command:VARSUB SCAN
LIST SR SAVELIST(RESLIST)
DO X = 1 TO @V(@RESLIST)
DISPLAY @V(@RESLIST-!X.-RESNAME)
END
Note: To make a
SAVELIST
accessible as an
OBJECT
variable, ensure that you use different names. If an
OBJECT
variable and SAVELIST
use the same name,
the SAVELIST
can be accessed only by USELIST
keywords and SHOW SAVELIST
.