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 > %system.nullfile%';
execute 'csv2gdx a1.csv output=y1.gdx index=1 values=2..101 useheader=y id=A > %system.nullfile%';
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="" > %system.nullfile%';
execute 'csv2gdx a2.csv output=y2.gdx colcount=3 index=1,2 value=3 id=A > %system.nullfile%';
rc=errorlevel;
abort$(rc <> 0)'CSV2GDX a2.csv had a problem';

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

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