1. Home
  2. GET directive

GET directive

Accesses details of the “environment” of a Genstat job.

Options

ENVIRONMENT = pointer Pointer given unit labels 'inprint', 'outprint', 'diagnostic', 'errors', 'pause', 'prompt', 'newline', 'case', 'run', 'wordlength', 'captions', 'typeset', 'cmethod', 'dataspace', 'algorithms', 'actionafterfault','unsetdummy' and 'language' used to save the current settings of those options of SET; default *
SPECIAL = pointer Pointer given unit labels 'units', 'blockstructure', 'treatmentstructure', 'covariate', 'asave', 'dsave', 'msave', 'rsave', 'tsave', 'vsave' and 'vcomponents, used to save the current settings of those options of SET; default *
LAST = text To save the last input statement; default *
FAULT = text To save the last fault code; default *
FIELDWIDTH = scalar Saves the fieldwidth currently defined as the default minimum for PRINT and other output commands
SIGNIFICANTFIGURES = scalar Saves the minimum number of significant figures currently to be supplied in the default formats determined by PRINT and other output commands
SEEDS = pointer Saves a pointer to variates defining the seeds currently used as defaults by random-number functions, the RANDOMIZE directive, and internally by various other directives
EPS = scalar To obtain the value of the smallest x (on this computer) such that 1+x > 1 ; default *
NJOB = scalar Number of the current job within the program; default *
VERSION = pointer Information about the version of Genstat that is being used; default *
PID = scalar Gets an integer value unique in the current job to use, for example, in names of temporary files
WORKINGDIRECTORY = text Saves the name of the current working directory

No parameters

Description

The GET directive allows you to access the current settings of the environment. This can be particularly useful in procedures, when details of the environment may need to change and be reset later to their original state. Sometimes it may be sufficient just to use the RESTORE option of the PROCEDURE directive for this purpose, but this causes them to be reset only at the end of a procedure.

The ENVIRONMENT and SPECIAL options of GET are used to access and save the current settings of options of the SET directive. The options of SET are divided into two groups. Those that apply to the general environment can be saved using the ENVIRONMENT option: these are INPRINT, OUTPRINT, DIAGNOSTIC, ERRORS, PAUSE, PROMPT, NEWLINE, CASE, RUN, WORDLENGTH, CAPTIONS, TYPESET, CMETHOD, DATASPACE, ALGORITHMS, ACTIONAFTERFAULT, UNSETDUMMY and LANGUAGE.Those that apply only to the save structures associated with particular directives can be saved using the SPECIAL option: these are UNITS, BLOCKSTRUCTURE, TREATMENTSTRUCTURE, COVARIATE, ASAVE, DSAVE, MSAVE, RSAVE, TSAVE, VSAVE and VSTRUCTURE. The labels of the pointer can be specified in either lower or upper case. or any mixture.

When you use the ENVIRONMENT option, Genstat sets up a pointer structure with units identified by the labels of the corresponding options of SET: these labels are 'inprint', 'outprint', and so on. The labels can be specified in either lower or upper case, or any mixture. Each unit of this pointer contains one or more strings, or a scalar, to represent the current setting. Thus, the statement

GET [ENVIRONMENT=Env]

would set up a pointer called Env with elements Env['inprint'], Env['outprint'], and so on. Each element can also be referred to by its position in the pointer; for example, Env['inprint'] is the same as Env[1].

Thus you do not have to know how the environment has been set in order to change it and then restore it; you can use GET to find out about it, and SET to change it back. For example, suppose that you wanted to stop temporarily the echoing of statements to the output file in a batch program. In the following program the first SET statement cancels the echoing, if indeed any echoing is in progress, and the second restores echoing to what it was before the first SET.

GET [ENVIRONMENT=Env]

SET [INPRINT=*]

(more statements)

SET [INPRINT=#Env['inprint']]

The SPECIAL option similarly sets up a pointer to save its information. The labels of the pointer are 'units', 'blockstructure', and so on. These can again be specified in either lower or upper case, or any mixture. The first element of the pointer is the units structure, or, failing that, the number of units if you have defined it for the current job. Printing the contents of the other elements is not usually informative, as the information is stored in coded form. The last ten elements of the pointer allow you to access the special save structures in the graphical and analysis directives. They are most useful for recovering information about an analysis when you have not already specified an explicit save structure. (Otherwise you would have to do the analysis all over again.) The SPECIAL option also provides a way of accessing the save structures associated with the analysis-of-variance directives BLOCKSTRUCTURE, COVARIATE and TREATMENTSTRUCTURE. This facility is used by the ASTATUS procedure, which may be a more convenient way of accessing these structures.

The LAST option is used to save the latest statement that you have input. You can then give the statement again later in the job without having to retype it, though some implementations of Genstat provide a simpler recall facility using the cursor keys. The option has the same effect as setting up a macro containing a single statement, and is accessed in the same way. For example, the statements

PRINT [SERIAL=yes; IPRINT=*; SQUASH=yes] !t('New Data'),Y

GET [LAST=Prdat]

(statements)

READ Y

(data)

##Prdat

would print the data, Y, under the title New Data and save the PRINT statement in a text called Prdat. After the next data set is read, the heading New Data and the new data set are printed in the same format as the previous data set.

The FAULT option is used to save the last fault code as a single string in a text structure. (A list of fault code definitions is available in the on-line help provided with most implementations of Genstat.) This option is particularly useful in procedures, in combination with the DIAGNOSTIC and FAULT options of SET, to control the printing of diagnostics.

The FIELDWIDTH option saves the fieldwidth currently defined as the default minimum for PRINT and other output commands, and the SIGNIFICANTFIGURES option saves the minimum number of significant figures currently to be supplied in the default formats determined by PRINT and other output commands (see PRINT for details).

The SEEDS option saves a pointer containing variates, each containing four values, which define the seeds currently used as defaults by random-number functions, the RANDOMIZE directive, and internally by various other directives. The pointer elements are labelled to identify the use of the seeds concerned: for example 'calculate', and 'randomize' for random-number functions and the RANDOMIZE directive respectively.

The EPS option is used to obtain the smallest number, ε, such that 1.0+ε is recognized by your computer to be greater than 1.0; this is an indication of the precision of the computer, which can affect the behaviour of some of the algorithms used by Genstat. EPS can be used, for example, when testing for convergence of iterative algorithms.

The NJOB option provides the current job number within the Genstat program. It is used in the start-up file to distinguish between statements to be executed just at the start of the program, and those to be executed at the start of each job.

The VERSION option allows you to find out which version of Genstat is being used. This is particularly useful within a general program or procedure. The first element of the pointer is given the label 'release', and is a scalar storing the release number, for example 15.10. The main information is in the integer part and the first decimal place; the second decimal may be used to distinguish between sub-releases with minor changes or corrections. The second element, labelled 'implementation' identifies the machine for which Genstat has been implemented, for example 'PC' or 'SUN'. The third is labelled 'system', and indicates the operating system, for example 'UNIX' or 'Windows. Finally, there is an element labelled 'version' that may contain further information relevant to particular implementations.

The PID option saves a scalar containing an integer value that is unique within the current job. You might want to use this, for example, to define a unique name for a temporary file.

The WORKINGDIRECTORY option saves a text containing the name of the current working directory.

Options: ENVIRONMENT, SPECIAL, LAST, FAULT, FIELDWIDTH, SIGNIFICANTFIGURES, SEEDS, EPS, NJOB, VERSION, PID, WORKINGDIRECTORY.

Parameters: none.

See also

Directives: SET, PROCEDURE.

Commands for: Program control.

Example

" Example 1:5.6.2 "
GET [ENVIRONMENT=Env]
PRINT [RLWIDTH=24; ORIENT=across; SQUASH=yes] Env[]; FIELD=16

Updated on June 19, 2019

Was this article helpful?