Switch DEBUG doesn't seem to be working in my code
+define+DEBUG is a compile time argument, not a run time. Moving +define+DEBUG to the appropriate line will fix the issue. See http://www.edaplayground.com/x/7ES

FYI: SystemVerilog has $test$plusargs/$value$plusargs which will allow run time arguments. Example with run time argument +DEBUG: http://www.edaplayground.com/x/5zF

always@(err) begin
  error=error+1;
  if($test$plusargs("DEBUG")) begin
    $display("Error at %d",$time);
  end
end