csv2gdx1.gms : Test gdxdump and csv2gdx

Description

Test gdxdump and csv2gdx


Category : GAMS Data Utilities library


Main file : csv2gdx1.gms   includes :  csv2gdx1.gms

$ontext
Test gdxdump and csv2gdx
$offtext


set m /m1*m100/
    n /n1*n100/;
parameter A(m,n);
A(m,n)$(Uniform(0,1) <= 0.5)=uniform(0,1);
scalar rc;

execute_unload "x.gdx",A;

execute 'gdxdump x.gdx output=a1.csv symb=A format=csv cdim=y > %NUL%';
execute 'csv2gdx a1.csv output=y1.gdx index=1 values=2..101 useheader=y id=A > %NUL%';
rc=errorlevel;
abort$(rc <> 0)'CSV2GDX a1.csv had a problem';

execute 'gdxdump x.gdx output=a2.csv symb=A format=csv cdim=n header="" > %NUL%';
execute 'csv2gdx a2.csv output=y2.gdx colcount=3 index=1,2 value=3 id=A > %NUL%';
rc=errorlevel;
abort$(rc <> 0)'CSV2GDX a2.csv had a problem';

execute 'gdxdiff x.gdx y1.gdx ID=A eps=1e-10 > %NUL%';
rc=errorlevel;
abort$(rc <> 0)'GDXDIFF no difference expected for Y1';

execute 'gdxdiff x.gdx y2.gdx ID=A eps=1e-10 > %NUL%';
rc=errorlevel;
abort$(rc <> 0)'GDXDIFF no difference expected for Y2';