1. Home
  2. SPLOAD directive

SPLOAD directive

Loads Genstat spreadsheet files.

Options

PRINT = string token What to print (catalogue); default cata
SCOPE = string token When SPLOAD is used within a procedure, this allows the data structures to be created in program that called the procedure (SCOPE=external) or in the main program itself (SCOPE=global) rather than within the procedure (local, external, global); default loca
REDEFINE = string token Whether to allow existing structures to have their type redefined (no, yes); default no
SYSTEM = string token Whether to include Genstat system structures in the catalogue (yes, no); default no
UNNAMED = string token Whether to include unnamed structures in the catalogue (yes, no); default no

Parameters

FILENAME = texts Names of spreadsheet files
SHEETNAME = texts, variates or scalars Names or numbers of the sheets to read from each file; default * reads them all
ISAVE = pointers Stores the identifiers of the structures loaded from each file

Description

The SPLOAD directive can be used to load data from a Genstat (i.e. GSH) spreadsheet file, specified using the FILENAME parameter. If the file is a multi-paged spreadsheet, the SHEETNAME parameter can be used to specify which sheet (or page) to read. If SHEETNAME is not set, all the pages are read. By default, a summary is produced listing the data that have been read; this can be suppressed by setting option PRINT=*. The SYSTEM and UNNAMED options control whether to include system and unnamed structures in the summary.

The SCOPE option is useful when SPLOAD is being used within a procedure. By default, the structures are created within the procedure. Alternatively, you can set SCOPE=external, to request that they are created in the program that called the procedure (which may itself be a procedure). Or you can set SCOPE=global to create them in the main program itself. However, care needs to be taken to ensure that there is no conflict with any existing structures.

If SPLOAD reads a structure from the spreadsheet file that has the same name as an existing structure, it will overwrite the values and attributes of the existing one, so long as the type is the same. Otherwise a VA 8 diagnostic message will be generated and SPLOAD will fail. To force SPLOAD to change the type of existing structures you can set the option REDEFINE=yes.

SPLOAD can interpret column names as suffixed identifiers (e.g C[1]), so long as numerical suffices are used. In this case pointers are created or modified as required (the pointer C points to C[1], C[2], etc.). If a text suffix is found (e.g. C['first']) the data can only be loaded if the pointer has already been defined using a POINTER statement.

The ISAVE parameter can be set to a pointer to store the identifiers (i.e. column names) read from the file. The pointer can then be used to refer to the loaded data (within a procedure, for example).

Options: PRINT, SCOPE, REDEFINE, SYSTEM, UNNAMED.

Parameters: FILENAME, SHEETNAME, ISAVE.

See also

Directive: READ.

Procedures: FILEREAD, IMPORT, EXPORT, SPCOMBINE.

Commands for: Input and output.

Updated on June 18, 2019

Was this article helpful?