Based on put file status

Top  Previous  Next

Conditionals may be placed in the GAMS code to do particular things only if some put file is open.  Such commands are of the form

 

$If putopen gamsstatement

$If not putopen gamsstatement

 

where the first of the two syntax alternatives yields a true conditional if both a file statement and at least one put statement have been executed.  Note this does not guarantee that a file will be open at runtime.

Example:

(putopen.gms)

$If putopen $goto around

file myfile;

put myfile;

$label around