gdxxrw4.gms : Test for some scalar read problems

Description

this problem resulted from trying to read a scalar value from xlsx

1. create the sheet


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gdxxrw4.gms

$title 'Test for some scalar read problems' (GDXXRW4,SEQ=175)

$callTool win32.msappavail Excel
$if errorlevel 1 $abort.noError "No Excel available"

* this problem resulted from trying to read a scalar value from xlsx

* 1. create the sheet
execute 'rm -f temp.gdx temp.xlsx';
scalar s target / 725 /;
execute_unload 'temp.gdx',s;
* stick a scalar in b2
execute '=gdxxrw temp.gdx output=temp.xlsx par=s rng=b2 cdim=0 rdim=0 trace=0';

* 2. the two blank labels result in an empty table
execute 'rm -f temp.gdx';
* this should result in an empty birthday
execute '=gdxxrw input=temp.xlsx output=temp.gdx par=birthday rng=A1:B2 cdim=1 rdim=1 trace=0';
parameter a(*,*); a('1','1') = 100;
execute_load 'temp.gdx', a=birthday;
display a;

* 3. now we read the scalar value
execute '=gdxxrw input=temp.xlsx output=temp.gdx par=birthday rng=B2 cdim=0 rdim=0 trace=0';
scalar b rewritten / 100 /;
execute_load 'temp.gdx', b=birthday;
display b;

abort$card(a) 'bad value for a - should be empty',a;
abort$(b <> s) ' bad value for b',s,b;