Distances1.gms : MDB2GMS Example 1 - Reading a single valued Table

Description

The programs selects distances from database "Sample.accdb"
and writes them to "distances.inc" or "distances.gdx" or both.
Note that at least one output file name has to be provided.
If no output file name is provided, the program starts to run
in interactive mode.

This model is referenced in "Example 1 - Reading a single valued Table" from
the MDB2GMS Documentation.

Keywords: MDB2GMS, data exchange, GAMS language features


Category : GAMS Data Utilities library


Main file : Distances1.gms   includes :  Distances1.gms  Sample.accdb

$title MDB2GMS Example 1 - Reading a single valued Table (Distances1,SEQ=032)

$onText
The programs selects distances from database "Sample.accdb"
and writes them to "distances.inc" or "distances.gdx" or both.
Note that at least one output file name has to be provided.
If no output file name is provided, the program starts to run
in interactive mode.

This model is referenced in "Example 1 - Reading a single valued Table" from
the MDB2GMS Documentation.

Keywords: MDB2GMS, data exchange, GAMS language features
$offText

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

$call mdb2gms I=Sample.accdb Q="SELECT city1, city2, distance FROM distances" O=distances.inc X=distances.gdx P=distances > %system.nullfile%
$ifE errorLevel<>0 $abort Error using MDB2GMS!

* the following options can be used
* B: Quote blanks
* M: Mute
* L: No listing
*$call =mdb2gms I=Sample.accdb Q="SELECT city1, city2, distance FROM distances" O=distances.inc X=distances.gdx P=distances B M L
*$ifE errorLevel<>0 $abort Error using MDB2GMS with options B, M, L activated!

* output could be produced seperately as follows:
*$call =mdb2gms I=Sample.accdb Q="SELECT city1, city2, distance FROM distances" O=distances.inc
*$ifE errorLevel<>0 $abort Error using MDB2GMS writing to include file only!
*$call =mdb2gms I=Sample.accdb Q="SELECT city1, city2, distance FROM distances" X=distances.gdx P=distances
*$ifE errorLevel<>0 $abort Error using MDB2GMS writing to gdx file only!

Set
   i 'canning plants' / seattle,  san-diego /
   j 'markets'        / new-york, chicago, topeka /;

Parameter dist1(i,j) 'distances in thousands of miles' /
$include distances.inc
/;

Parameter dist2(i,j) 'distances in thousands of miles';
$gdxIn 'distances.gdx'
$load dist2 = distances
$gdxIn

display dist1, dist2;