you need to eclose the whole macro in curly brackets:
{
your example
}
and to fix a couple of comment lines which got merged with the source code.
then the example works OK. BTW, wasn't there a claim that "global" curly
brackets are not necessary in macro files any more?
Pasha.