Hi,
What is the correct syntax of including the command line keyword in the code?
For example, I am executing this command
>gams mycode keep=1 --USE_GAMS='YES'
So, how should I write the 'keep=1 --USE_GAMS='YES' ' in the syntax of the .gms file instead of writing each time in the command line.
My other question is:
What is the correct syntax of a set command in the .gms script.
For example:
In the command prompt I write:
>set GMSPYTHONLIB=c:\path\to\python\python38.dll
So, how should I write it inside the .gms script so that I don't need to set it each time in the command line when I wish to run the script?
Regards,
Jubeyer
Command line Keyword in the gams script
Re: Command line Keyword in the gams script
Hi,
please find some commnets below.
--USE_GAMS is a double dash parameter that defines a compile time variable. In your gms file you could add
You use 'YES' as the default value for the compile time variable.
I hope this helps!
Fred
please find some commnets below.
keep is a GAMS command line parameter that cannot be set inside the gms file. If you aplways want to keep your scratch directory for all GAMS runs, you could put that command line parameter into your GAMS configuration file.Jubeyer wrote: ↑1 year agoHi,
What is the correct syntax of including the command line keyword in the code?
For example, I am executing this command
>gams mycode keep=1 --USE_GAMS='YES'
So, how should I write the 'keep=1 --USE_GAMS='YES' ' in the syntax of the .gms file instead of writing each time in the command line.
--USE_GAMS is a double dash parameter that defines a compile time variable. In your gms file you could add
Code: Select all
$if not set USE_GAMS $set USE_GAMS YES
You could use the GAMS configuration file again or your OS' way to permanently set environment variables. You cannot control the Python lib used for embedded code from within your gms file.Jubeyer wrote: ↑1 year agoMy other question is:
What is the correct syntax of a set command in the .gms script.
For example:
In the command prompt I write:
>set GMSPYTHONLIB=c:\path\to\python\python38.dll
So, how should I write it inside the .gms script so that I don't need to set it each time in the command line when I wish to run the script?
I hope this helps!
Fred
Re: Command line Keyword in the gams script
Hi,
I have a similar question about the correct syntax for passing double dash parameter value from command line to the main program.
For example, I am executing this command
$call gams test_doubledash.gms --month = July
I am passing "July" to the main program. In the main program I have:
$if not set month $set month Jan
if ( %month% = Jan,
Display "Jan";
elseif %month% = Apr,
Display "Apr";
elseif %month% = July,
Display "July";
elseif %month% = Oct,
Display "October";
);
I am getting unknow symbol error messages for every elseif command line, except July. Any idea where I got it wrong? Thanks for the help in advance! JSS
I have a similar question about the correct syntax for passing double dash parameter value from command line to the main program.
For example, I am executing this command
$call gams test_doubledash.gms --month = July
I am passing "July" to the main program. In the main program I have:
$if not set month $set month Jan
if ( %month% = Jan,
Display "Jan";
elseif %month% = Apr,
Display "Apr";
elseif %month% = July,
Display "July";
elseif %month% = Oct,
Display "October";
);
I am getting unknow symbol error messages for every elseif command line, except July. Any idea where I got it wrong? Thanks for the help in advance! JSS
Re: Command line Keyword in the gams script
Hi,
You can use $ifthen (or its case insensitove variant $iftheni).
I hope this helps!
Fred
You can use $ifthen (or its case insensitove variant $iftheni).
Code: Select all
$if not set month $set month Jan
$iftheni %month%==Jan
Display "Jan";
$elseIfi %month%== Apr
Display "Apr";
$elseIfi %month%==July
Display "July";
$elseIfi %month%==Oct
Display "October";
$endif
Fred
Re: Command line Keyword in the gams script
Thanks Fred! It is very helpful!