Basing conditionals on number of errors

Top  Previous  Next

One may set up a procedure to do certain things in a job depending on the number of execution errors encountered.  This is done using the function execerror.  In particular one could use GAMS code as follows (executcl.gms)

 

result(elements)=data1(elements)**2.1/datadiv(elements);

display result;

*cause z to be undefined

scalar z;

z=1/0;

if(execerror gt 0,

   result(elements)$(result(elements) = z)=0;);

display result;

 

which removes the execution errors from the result array.