SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: Reeky on April 18, 2017, 11:02:26 PM

Title: Macro error "Global within global not allowed"
Post by: Reeky on April 18, 2017, 11:02:26 PM
Hey All - My simple macro below gives the error "Global within global not allowed" on the second "g" substitution. The remainder of the macro finishes without error. If I enter the commands manually in the same order they all succeed. Any idea what that error means?

Thanks!

_command Load_Table_Test() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   _macro('R',1);
   ex_parse_and_execute('g/\[datetime/ s/$/      --was DATETIME/');  // <--SUCCEEDS
   ex_parse_and_execute('g/\[float/ s/$/      --was FLOAT/');    // <--ERROR
   ex_parse_and_execute('g/\[int/ s/$/      --was INT/');  // <--SUCCEEDS
   ex_parse_and_execute('1,$ s/\[datetime\]/NVARCHAR(255)/');
   ex_parse_and_execute('1,$ s/\[float\]/NVARCHAR(255)/');
   ex_parse_and_execute('1,$ s/\[int\]/NVARCHAR(255)/');
   ex_parse_and_execute('g/\[ntext/ s/$/      --NTEXT column has restrictions/');
}
Title: Re: Macro error "Global within global not allowed"
Post by: Graeme on April 19, 2017, 11:37:18 PM
I don't really know what VIM ex mode is but I notice that on this page there's also a "global within global not allowed" error message.

https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.bpxa500/comvi.htm (https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.bpxa500/comvi.htm)

Can you post some example text that these commands can be tested on and explain what ex mode is for?

In case you didn't notice, the error message you're getting comes from the function __ex_global.  prev-index and last-index are indexes into the slickedit names table.  I'm not 100% sure when they get updated.