Put

Top  Previous  Next

The basic syntax for the put command is as follows

 

Put localfileidentifier item1 item2, item3;

 

where localfileidentifier identifies the place to which the put output is to be directed.  Item1, item2 and item3 and any other following trailing items are some mixture of data items, labels and formatting commands as discussed immediately below.

The localfileidentifier entry is not always required as GAMS will direct output to the localfileidentifier found in the last instance of a put localfileidentifier command.
At least one command of the form put localfileidentifier must appear in the program before any other puts can appear.
One can have a program which initially puts to one localfileidentifier files and switches to another then switches back as illustrated below (putex2.gms)

 

file my1;

file myfilewithalongname;

put my1, 'First line' /;

put myfilewithalongname, 'First line over there' /;

put my1, 'Second line' /;

put myfilewithalongname, 'Second line over there'/;

 

 which results in file my1.put with contents

 

First line

Second line

 

 and a file named myfilewithalongname.put with contents

 

First line over there

Second line over there

 

The separators between the items can either be spaces or commas as illustrated above.