$title 'Test for execerr option' (execerr1,SEQ=640) $onText Contributor: Michael Bussieck, February 2014 $offText $ setGlobal b '' $if %system.filesys%==UNIX $setGlobal b \ $onEchoV > ee1.gms variable x; equation e; e.. x =e= 0; x.lo = %lo%; x.up = %up%; model m /e/; x.l = 1/%div%; %ifb%solve m min x us lp%ife%; execerror = 0; $offEcho * * Execution error triggered during model generation * * No way to recover, execerror=0 won't be executed $call gams ee1 --lo=1 --up=0 --div=1 --ifb=%b%"%b%" --ife=%b%"%b%" lo=%gams.lo% execerr=0 $if not errorlevel 1 $abort unexpected behavior * No way to recover even when inside an if, execerror=0 won't be executed $call gams ee1 --lo=1 --up=0 --div=1 --ifb=%b%"if%b%(1,%b%" --ife=%b%"%b%)%b%" lo=%gams.lo% execerr=0 $if not errorlevel 1 $abort unexpected behavior * We recover (execerror=0 will be executed) because we increase error limit $call gams ee1 --lo=1 --up=0 --div=1 --ifb=%b%"%b%" --ife=%b%"%b%" lo=%gams.lo% execerr=1 $if errorlevel 1 $abort unexpected behavior * We recover (execerror=0 will be executed) because we increase error limit $call gams ee1 --lo=1 --up=0 --div=1 --ifb=%b%"if%b%(1,%b%" --ife=%b%"%b%)%b%" lo=%gams.lo% execerr=1 $if errorlevel 1 $abort unexpected behavior * * Execution error before solve * * The solve gets aborted and hence we stop execution, execerror=0 won't be executed $call gams ee1 --lo=0 --up=1 --div=0 --ifb=%b%"%b%" --ife=%b%"%b%" lo=%gams.lo% execerr=0 $if not errorlevel 1 $abort unexpected behavior * The in-if-solve will be skipped even though limit is reached and we continue execution $call gams ee1 --lo=0 --up=1 --div=0 --ifb=%b%"if%b%(1,%b%" --ife=%b%"%b%)%b%" lo=%gams.lo% execerr=0 $if errorlevel 1 $abort unexpected behavior