Save and restart calling GAMS from within GAMS

Top  Previous  Next

One may not like the IDE command line option since it requires one to wait for one job before beginning the next.  One can overcome this by using GAMS to call itself.  To do this we enter GAMS command line instructions within quotes in an Execute statement as follows (saverestar.gms) where I am also using the $log command to send a message to the IDE process window.

 

execute "GAMS trandata              s=s1"

$log done1

execute "GAMS tranmodl    r=s1      s=s2"

$log done2

execute "GAMS tranrept    r=s2"

$log done3

 

Note when one does this the GAMS jobs run in the background without any log reporting appearing in the process window.  To get that information you must make the DOS window visible under File Options in the Execute tab.  You can also use syntax like the following (saverestar.gms)

$set gamsparm "ide=%gams.ide% lo=%gams.lo% errorlog=%gams.errorlog% errmsg=1"

execute "GAMS trandata  %gamsparm%         s=s1"

execute "GAMS tranmodl  %gamsparm%  r=s1   s=s2"

execute "GAMS tranrept  %gamsparm%  r=s2"

 

The gamsparm item here is a control variable and in this particular case it is being set up to tell GAMS that the

IDE is being used  (ide=1 on a PC)
To write the log to a file which in turn is intercepted by the IDE (lo=3 on a pc)
To redirect a given number of error messages to that file (errorlog=99 on a pc)
To place error messages next to the GAMS lines causing them (errmsg=1)

 

The syntax %gamsparm% is placing the contents of gamsparm in the calling parameters for GAMS.  The syntax %gams.ide% picks up the setting of the GAMS command line parameter ide on the computer being used while %gams.lo% and %gams.errotlog% pick up the values of the lo and errorlog GAMS command line parameters.

The same syntax works with $Call.