Description
This example demonstrates how to dump the data of the trnsport model to an Access database file. In addition, the column labeling in the database file for data with missing or non-unique domain information is presented. This model is referenced in the "Intro" example resp. in the "Dumping the Contents of trnsport.gdx" example from the GDX2ACCESS Documentation. Keywords: GDX2ACCESS, data exchange, GAMS language features
Category : GAMS Data Utilities library
Main file : GDX2ACCESSExample1.gms includes : GDX2ACCESSExample1.gms
$title Dumping the Contents of trnsport.gdx (GDX2ACCESSExample1,SEQ=125)
$onText
This example demonstrates how to dump the data of the trnsport model to an
Access database file. In addition, the column labeling in the database file for
data with missing or non-unique domain information is presented.
This model is referenced in the "Intro" example resp. in the "Dumping the
Contents of trnsport.gdx" example from the GDX2ACCESS Documentation.
Keywords: GDX2ACCESS, data exchange, GAMS language features
$offText
$callTool win32.msappavail Access
$if errorlevel 1 $abort.noError "No Access available"
* use an INI file here to specify the database file format
$onEcho > howToWrite.ini
[settings]
dbVersion=12
$offEcho
* first part: dumping the data of the trnsport model to an accdb. file
execute 'gamslib trnsport > %system.nullfile%';
execute 'gams trnsport lo=0 gdx=trnsport';
execute 'gdx2access trnsport.gdx @howToWrite.ini > %system.nullfile%';
* second part: demonstrating the column labeling for data with missing or non
* unique domain information (like parameter B resp. A)
Set i / i1*i5 /;
Alias (i,j,k);
Parameter A(i,i,i) 'domain informations, but the column name would not be unique';
A(i,j,k) = uniform(0,1);
Parameter B 'no domain information' / i1.i1 1, i1.i2 2, i2.i1 3, i2.i2 4 /;
execute_unload 'AB.gdx', A, B;
execute 'gdx2access AB.gdx > %system.nullfile%';