Based on user options and command line:  --  //  -/  /-  User1-5

Top  Previous  Next

(user.gms)

Useful ways of controlling GAMS from the command line is use of the GAMS permitted user-defined parameters and – , //, -/ , or /- parameters in the GAMS call or the parameter box of the IDE.  For example if one puts user1=nonlinear in the control box I can treat a model as either linear or nonlinear depending user1 setting

 

_img64

 

and when the user1 setting is coupled with the following

 

$If not "%gams.user1%" == "nonlinear" $goto arond 

 

then the NLP form is controlled from command line

 

gams myrun user1=nonlinear

 

One can also use user2, user3, user4, user5.  The abbreviation for these items is U1, U2, U3, U4, U5

Another way this can be done is through use of the – syntax.  There through entry of 2 minus signs followed by a name allows one to define a global control variable.

The syntax is any of the following four

 

--name=string

//name=string

/-name=string

-/name=string

 

where name is the name of a control variable chosen by the user and string a text string.

For example (minusminus.gms) one could use

 

--keycity=Boston //myflag=modes /-myvalue=7.6 -/dothis="display x;"

 

specifying the control variables keycity, myflag, myvalue and dothis with the strings Boston, modes, 7.6 and display x;  respectively.  In tune when one had a statement

 

x("%keycity%","%myflag%")=%myvalue%;

%dothis%

 

it would become

 

x("boston","mode")=7.6;

display x;

 

The status of the variables entered through – etc. syntax  in terms of whether it is scoped, local, or global can be changed using a prior ST command line parameter.

GAMS checks for proper spelling and definition of these items when the dollar command $setddlist is entered in the code.