gdx1.gms : Checks opening of gdx files for read and write

Description


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gdx1.gms

$title Checks opening of gdx files for read and write (GDX1,SEQ=19)
set i / 1,2,3 /;
$onDollar
$gdxOut good
$if not errorfree $goTo problem
$call =test -d ugly.gdx
$if errorlevel 1 $call mkdir ugly.gdx
$gdxOut ugly
$if errorfree     $goTo problem
$clearError
$gdxIn  ugly
$if errorfree     $goTo problem
$clearError
$if exist gdxfail.gdx $call rm gdxfail.gdx
$gdxIn gdxfail
$if errorfree     $goTo problem
$clearError
$echo this is wrong > wrong.gdx
$gdxIn wrong
$if errorfree     $goTo problem
$clearError
$call rmdir ugly.gdx
$call rm    wrong.gdx good.gdx
$terminate

$label problem
$call rmdir ugly.gdx
$call rm    wrong.gdx  good.gdx
$error gdx problems encountered
$terminate