Setargs

Top  Previous  Next

Sets up substitutable parameters as GAMS control variable names.

 

$setargs args

 

For example using

 

$setargs one two thisthree allremain

 

causes a Batinclude file to use one in place of %1, two in place of %2 and thisthree in place of %3 and all remaining arguments are associated with allremain.  Thus one could use code like

 

$setargs one two thisthree allremain

%one% = %two% * %thisthree%;

 

in the BATINCLUDE instead of

 

%1=%2*%3;

 

setargs.gms provides an example.  Note setargs must appear in the Batincluded file.  Also note one can also use a * or a . or a / to cause a numbered item to be skipped over.

For example

 

$setargs * * thisthree *

 

will only put a new name in for %3.

Use of this command is further discussed in the conditional compilation chapter.