1. Home
  2. INPUT directive

INPUT directive

Specifies the input file from which to take further statements.


PRINT = string tokens What output to generate from the statements in the file (statements, macros, procedures, unchanged); default stat
REWIND = string token Whether to rewind the file (yes, no); default no


    scalar Channel number of input file


Having opened a file of Genstat statements on another input channel (for example by the OPEN directive) you can switch control to that channel at any time using an INPUT statement. You specify the channel as a number or as a scalar containing that number. For example,



The file can contain any valid Genstat statements: they will be executed just as if they had been on the original input channel. In this file you could use an INPUT statement to switch back to channel 1 after a while. Alternatively, you may have set up several input files and jump from one to another, again using INPUT. You can use RETURN to go back to the previous channel or STOP to end this run of Genstat. If the end of the file is reached without finding any of these statements, control will be passed back to the previous input channel as explained in the description of the RETURN directive. Note that if you use INPUT to go back to an earlier channel, you may affect the way in which RETURN works (again see the description of RETURN).

The PRINT option can be used to specify whether the statements read from the file should be echoed to the current output channel. This is used in the same way as INPRINT in JOB and SET.

The REWIND option allows you to return to the beginning of the file. You might need to do this, for example, if you had made an error, so that the statements on the secondary input file were executed wrongly. After correcting your error you could set REWIND=yes to start again from the beginning of the file.


Parameter: unnamed.

See also

Directives: RETURN, OPEN.

Commands for: Input and output.

Updated on June 19, 2019

Was this article helpful?