Thursday, December 11, 2008

GAMS $macro

GAMS 22.9 has some macro facilities. I don't completely understand it. The following model:

$macro a b
scalar a/1/;
display a;

gives:
   1  $macro a b
2 scalar a/1/;
**** $195,409
**** 195 Symbol redefined with a different type
**** 409 Unrecognizable item - skip to find a new statement
**** looking for a ';' or a key word to get started again
3 display b;
**** $140
**** 140 Unknown symbol

**** 3 ERROR(S) 0 WARNING(S)
Apparently it is skipping some substitutions. This is not like what I am used to in macro preprocessors for languages like C and Delphi.

I would expect this model to behave like:
scalar b/1/;
display b;