gdxxrw_autoopen.gms : Tests that gdxxrw calls the auto_open macro facility

Description

The macro auto_open of mytest.xlsm opens the file myvalue.txt and populates
the cell A2 with the value found in the file. Another subroutine doubles the
value of A2 and stroes the result into B2.

This tests that gdxxrw calls the auto_open macro facility

Contributor: M. Bussieck, October 2014


Category : GAMS Data Utilities library


Main file : gdxxrw_autoopen.gms   includes :  gdxxrw_autoopen.gms  mytest.xlsm

* The macro auto_open of mytest.xlsm opens the file myvalue.txt and populates
* the cell A2 with the value found in the file. Another subroutine doubles the
* value of A2 and stroes the result into B2.
*
* This tests that gdxxrw calls the auto_open macro facility
*
* Contributor: M. Bussieck, October 2014


$if %system.filesys% == UNIX $abort.noerror 'This model cannot run on a non-Windows platform';
$call msappavail -Excel
$if errorlevel 1 $abort.noerror 'Microsoft Excel is not available!';

set h / org, double /;
parameter p128(h), p64(h);

$echo 128 > myvalue.txt
$call gdxxrw runmacros=3 i=mytest.xlsm o=p128.gdx par=p128 rng=Sheet1!a1 rdim=0 cdim=1 trace=0
$if errorlevel 1 $abort problem retrieving 128 data

$echo 64 > myvalue.txt
$call gdxxrw runmacros=3 i=mytest.xlsm o=p64.gdx par=p64 rng=Sheet1!a1 rdim=0 cdim=1 trace=0
$if errorlevel 1 $abort problem retrieving 64 data

$gdxin p128
$load p128

$gdxin p64
$load p64
$gdxin

* Expected parameters
Parameter
   e128(h) / org 128, double 256 /
   e64(h)  / org  64, double 128 /;

Set error128(h), error64(h);

error128(h) = e128(h)<>p128(h);
abort$card(error128) error128, e128, p128;

error64(h) = e64(h)<>p64(h);
abort$card(error64) error64, e64, p64;