
When the data for this table is coming from a program it is more convenient to say in the main program: Parameter d(i,j) 'distance in thousands of miles' Īnd to have the include file data.inc contain the machine generated statements: d("seattle","new-york") = 2.5 For instance, consider the following fragment from model : Table d(i,j) 'distance in thousands of miles' Therefore, often parameters are used and long series of assignment statements are generated. A GAMS table is in fact very well suited for a human being to be read or written, but it is rather awkward for programs to generate (e.g., the numbers have to be approximately below the corresponding headers). For instance, when data for a table is actually coming from another environment, one could replace the TABLE statement by an include statement. This can be very handy when including data from a separate text file. As a result, the GAMS code behaves as if the $include statement has been replaced by the content of the file to be included. The $include compile-time command is used to instruct the GAMS compiler to include the context of a different file at the current position of the input stream. This way, model specification and data input can be separated into different files. Thus, including a text file within a data statement (see also Data Entry: Parameters, Scalars and Tables) allows for an easy way to include data from a text file, as long as the syntax in the text file can be understood by the GAMS compiler.

The file content is then assumed to be GAMS code.


GAMS can read arbitrary text files during compile time by inserting them into the compiler input stream. This tutorial describes some ways on how to exchange data between GAMS and text files (usually in ASCII format).
