1. Home
  2. Input and output

Input and output

Data can be read into Genstat data structures using the READ directive or the FILEREAD and TX2VARIATE procedures:

    READ reads data from an input file, an unformatted file or a text
    FILEREAD reads data from a text file, assumed to be in a rectangular array
    SPLOAD loads data from a Genstat spreadsheet file
TX2VARIATE

reads values into a variate from a text structure

Files can be connected to input, output or other channels during execution of a Genstat program. Channels can also be closed, terminating the connection, so that they can be attached to other files.

    OPEN opens files and connects them to Genstat input/output channels
    CLOSE closes files, freeing the channels to which they were attached

The channel from which input statements are taken can be changed, as can the channel to which output is sent. It is also possible to send a transcript (or copy) of input and/or output to output files, to skip sections of input or output files, and to obtain information about the files connected to each channel.

    INPUT specifies the channel from which subsequent statements should be read
    RETURN returns to the previous input channel
    OUTPUT specifies the channel to which future output should be sent
    COPY requests a transcript of subsequent input and/or output
    SKIP skips lines of input or output files
    ENQUIRE provides details about files opened by Genstat

The following commands allow you to generate output.

    PRINT prints data in tabular form to an output file or text
    CAPTION prints captions and titles in standardized formats
    LIST lists details of the data structures that currently exist in your program
    PAGE moves to the top of the next page of an output file
PFACLEVELS prints levels and labels of factors
    PLINK prints a link to a graphics file into an HTML file
    DISPLAY repeats the last Genstat diagnostic
    DUMP prints attributes of data structures and other internal information
    DECIMALS sets the number of decimals for a structure, using its round-off
    MINFIELDWIDTH calculates minimum field widths for printing data structures

You can copy, delete and rename files:

    FCOPY makes copies of files
    FDELETE deletes files
    FRENAME renames files

You can define menus:

    QDIALOG produces a modal dialog box to obtain a response from the user
    QUESTION obtains a response using a Genstat menu (formed using QDIALOG)
    QFACTOR allows the user to decide to convert texts or variates to factors
    QLIST presents a sequence of menus to obtain a response from a list

The values of a data structure, with all its defining information, can be stored in a sub-file of a “backing-store” file. It can then be retrieved in a later job, without the need to repeat the definitions. The current state of the whole job can also be dumped to an unformatted file, so that it can be picked up and continued on a later occasion.

    STORE stores data structures in a backing-store file
    RETRIEVE retrieves data structures from a backing-store file
    CATALOGUE displays the contents of a backing-store file
    MERGE copies sub-files of backing-store files into a single file
    RECORD dumps the complete details of a job
    RESUME reads and restarts a recorded job

Genstat has several additional commands for accessing data from spreadsheets, databases and other systems. However, these may be unavailable in some implementations.

    CSPRO reads a data set from a CSPro survey data file and dictionary, and loads it into Genstat or puts it into a spreadsheet file
    EXPORT outputs data structures in foreign file formats, or as plain or comma-delimited text
    IMPORT reads data in a foreign file format and loads it or converts it to a spreadsheet file
    DBCOMMAND runs an SQL command on an ODBC database
    DBEXPORT update an ODBC database table using data from Genstat
    DBIMPORT loads data into Genstat from an ODBC database
    DBINFORMATION loads information on the tables and columns in an ODBC database
    DDEEXPORT sends data or commands to a Dynamic Data Exchange server
    DDEIMPORT gets data from a Dynamic Data Exchange (DDE) server
GRIBIMPORT reads data from a GRIB2 meteorological data file, and loads it or converts it to a spreadsheet file
    SPCOMBINE combines spreadsheet and data files, without reading them into Genstat
    %CD changes the current directory
Updated on September 4, 2019

Was this article helpful?