gdx2.gms : Test loading of old GDX files from other platforms

Description


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gdx2.gms

$title Test loading of old GDX files from other platforms (gdx2,SEQ=89)

$echo {print "'" substr($0,match($0,/[1-9][0-9]\.[0-9]/),4)"'"} > d.awk
$echo {print substr($0,match($0,/gdx\//)+10,3)}                 > p.awk
$call gmsunzip -v gdxtest | grep -i tlnx.gdx     | awk -f d.awk | sort | uniq > gdist.txt
$call gmsunzip -v gdxtest | grep -i t...\.gdx | awk -f p.awk | sort | uniq >  plat.txt
$call rm -rf gdx

Set gdist distribution GDX files /
$include gdist.txt
    /
    plat platforms /
$include plat.txt
    /;

* Create run script
$echo display x.l; > rtrans.gms

$escape =
$onEcho > gtrans.gms
set i,j; parameter c(*,*);
$gdxIn %=gdxfile%=
$load i j c
$gdxOut t.gdx
$unLoad i j c

$gdxOut
execute_load   "%=gdxfile%=" i,j,c
execute_load   "t.gdx"       i,j,c
execute_unload "t.gdx"       i,j,c
$offEcho
$escape %

file fx /gdxscript.gms/; fx.pw=1024;

put fx / '$call gmsunzip -Coq gdxtest gdx\*'
       / '$if errorlevel 1 $abort "Could not run gmsunzip"'
loop((gdist,plat),
  put  / '$if exist gdx%system.dirsep%' gdist.tl:0 '%system.dirsep%t' plat.tl:0 '.gdx'
       / '$call =gams gtrans lo=0 --gdxfile gdx%system.dirsep%' gdist.tl:0 '%system.dirsep%t' plat.tl:0
       / '$if errorlevel 1 $error "GDX ' plat.tl:0 ' Distribution:' gdist.tl:0 '"';
);
putclose fx;

Scalar rc;
execute '=gams gdxscript lo=0';
rc=errorlevel;
abort$rc 'GDX Test Failed';